Advertisement
jwow22

Map Tile

Jan 4th, 2022
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. public class Tile : MonoBehaviour
  2. {
  3.     // Grid
  4.     [NonSerialized] public Vector2Int gridPosition;
  5.     [NonSerialized] public Vector2 worldPosition;
  6.     [NonSerialized] public Tile[] neighbourTiles = new Tile[4];
  7.    
  8.     // Objects
  9.     [SerializeField] public List<GridObject> currentObjects;
  10.    
  11.     // Pathfinding
  12.     [NonSerialized] public Tile parentTile;
  13.     [NonSerialized] public int gCost;
  14.     [SerializeField] public int hCost;
  15.    
  16.     public bool walkable;
  17.     public bool targeted;
  18.     public int fCost => gCost + hCost;
  19.    
  20.     private void Awake()
  21.     {
  22.         currentObjects = new List<GridObject>();
  23.         walkable = true;
  24.     }
  25.  
  26.     public void ResetCost()
  27.     {
  28.         gCost = 0;
  29.         hCost = 0;
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement