Advertisement
kissemisse

Cell Point

Mar 14th, 2021
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class CellPoint : MonoBehaviour {
  4.    
  5.     // Each cell contains data about what kind of structure is built on it
  6.    
  7.     private int x, z;
  8.  
  9.     private CellType currentCellType = CellType.Empty;
  10.     private bool _occupied;
  11.     private Transform _cellBuilding;
  12.  
  13.     public GameObject relatedStructure;
  14.  
  15.     public void SetCellCords(int newX, int newZ) {
  16.         x = newX;
  17.         z = newZ;
  18.     }
  19.  
  20.     public int GetCellX() { return x; }
  21.     public int GetCellZ() { return z; }
  22.    
  23.     public void SetCellType(CellType newCellType) {
  24.         currentCellType = newCellType;
  25.     }
  26.  
  27.     public CellType GetCurrentCellType() {
  28.         return currentCellType;
  29.     }
  30.  
  31.     public bool IsEmpty() {
  32.         return currentCellType == CellType.Empty;
  33.     }
  34. }
  35.  
  36. public enum CellType {
  37.     Empty,
  38.     Road,
  39.     Structure,
  40.     None
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement