| 12345678910111213141516171819202122232425262728293031323334353637 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class ZoneManager : MonoBehaviour
- {
- public List<Collider> allowedZones;
- public bool IsPositionAllowed(Vector3 position)
- {
- foreach (var zone in allowedZones)
- {
- if (zone.bounds.Contains(position))
- {
- return true;
- }
- }
- return false;
- }
- private void OnDrawGizmos()
- {
- Gizmos.color = Color.yellow;
- int gridSize = 10;
- float cellSize = 1f;
- for (int x = 0; x <= gridSize; x++)
- {
- Gizmos.DrawLine(new Vector3(x * cellSize, 0, 0), new Vector3(x * cellSize, 0, gridSize * cellSize));
- }
- for (int z = 0; z <= gridSize; z++)
- {
- Gizmos.DrawLine(new Vector3(0, 0, z * cellSize), new Vector3(gridSize * cellSize, 0, z * cellSize));
- }
- }
- }
|