public static void GenerateGrid(int chunkCountX, int chunkCountZ) { if (Metrics.gridObject != null) { Metrics.Destroy(Metrics.gridObject); } Metrics.gridObject = new GameObject("Grid"); Metrics.gridObject.AddComponent <Pathfinder>(); PathGrid.Invalidate(); obstacles.Clear(); Metrics.obstacleContainer = new GameObject("Obstacles"); Metrics.obstacleContainer.transform.SetParent(Metrics.gridObject.transform, true); items.Clear(); Metrics.itemContainer = new GameObject("Items"); Metrics.itemContainer.transform.SetParent(Metrics.gridObject.transform, true); entities.Clear(); Metrics.entityContainer = new GameObject("Entities"); Metrics.entityContainer.transform.SetParent(Metrics.gridObject.transform, true); waypoints.Clear(); Metrics.waypointContainer = new GameObject("Waypoints"); Metrics.waypointContainer.transform.SetParent(Metrics.gridObject.transform, true); damageables.Clear(); Metrics.uniqueID = 0; Metrics.chunkCountX = chunkCountX; Metrics.chunkCountZ = chunkCountZ; width = Metrics.chunkCountX * Metrics.chunkWidth; length = Metrics.chunkCountZ * Metrics.chunkLength; GenerateChunks(); GenerateCells(); Metrics.CenterCamera(); if (Metrics.debug == true) { Debug.Log("Grid generated with " + (cells.Length) + " cells across " + (chunks.Length) + " chunks."); } }
public static void ItemDestroyed(ItemData instance) { items.Remove(instance.uniqueID); PathGrid.Invalidate(); StatsForNerds.UpdateItemCount(items.Count); }
public static void ItemInstanciated(ItemData instance) { items.Add(instance.uniqueID, instance); PathGrid.Invalidate(); StatsForNerds.UpdateItemCount(items.Count); }
public static void ObstacleDestroyed(ObstacleData instance) { obstacles.Remove(instance.uniqueID); PathGrid.Invalidate(); StatsForNerds.UpdateObstacleCount(obstacles.Count); }
public static void ObstacleInstanciated(ObstacleData instance) { obstacles.Add(instance.uniqueID, instance); PathGrid.Invalidate(); StatsForNerds.UpdateObstacleCount(obstacles.Count); }
public static void InstantiateCeiling(CeilingData prototype, CellData cell) { CeilingData.Instantiate(prototype, cell); PathGrid.Invalidate(); }
public static void InstantiateStructure(StructureData prototype, CellData cell) { StructureData.Instantiate(prototype, cell); PathGrid.Invalidate(); }
public static void InstantiateFoundation(FoundationData prototype, CellData cell) { FoundationData.Instantiate(prototype, cell); PathGrid.Invalidate(); }