| 12345678910111213141516171819202122232425262728293031323334 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class BuildingGridNode {
- GridXZ<BuildingGridNode> grid;
- int x, z;
- private Transform transform;
- public BuildingGridNode(GridXZ<BuildingGridNode> grid, int x, int z) {
- this.grid = grid;
- this.x = x;
- this.z = z;
- }
- public void SetTransform(Transform transform) {
- this.transform = transform;
- grid.TriggerGridObjectChanged(x, z);
- }
- public void ClearTransform() {
- this.transform = null;
- grid.TriggerGridObjectChanged(x, z);
- }
- public bool CanBuild() {
- if (UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject()) return false; // Check if over UI element
- return transform == null;
- }
- public override string ToString() {
- return x + ", " + z + " \n" + transform;
- }
- }
|