public SetBlockableObject ( |
||
gameObject | ||
Résultat | void |
public static void SetTowerForLevelMap(Tower tower, Tile tile) { tile.SetBlockableObject(tower); //tile2.SetBlockableObject(tower); //UpdateTilePaths(); //List<Tile> walkableNeighbors = GetWalkableNeighbors(tile); for (int i = 0; i < tile.tileNeighbors.Count; i++) { tile.tileNeighbors[i].RegisterTowerListenerForUnit(ref tower); } for (int i = 0; i < tile.tileNeighbors.Count; i++) { tile.tileNeighbors[i].RegisterTowerListenerForTower(ref tower); } //OnTowerCreated(); }
public static bool SetTower(ref Tower tower, ref Tile Tile2) { //Tile2.SetBlockableObject(tower); //AStar2.UpdateWalkableNeighborsForTileID(Tile2.ID); if (IsTilePathsValidFor(Tile2.ID)) { Tile2.SetBlockableObject(tower); //AStar2.UpdateWalkableNeighborsForTileID(Tile2.ID); AStar2.UpdateNeeded = true; ////UpdateTilePaths(); //walkableNeighbors = GetWalkableNeighbors(Tile2); //IDEA: WHAT ABOUT OFFSETTING THIS TO THE THREAD? //Maintain a list of towers to update on the next update pass after walkableNeighbors is relevant? for (int i = 0; i < Tile2.tileNeighbors.Count; i++) { Tile2.tileNeighbors[i].RegisterTowerListenerForUnit(ref tower); } for (int i = 0; i < Tile2.tileNeighbors.Count; i++) { Tile2.tileNeighbors[i].RegisterTowerListenerForTower(ref tower); } tower.tile = Tile2; OnTowerCreated(); return true; } // RemoveTower(ref Tile2); //Tile2.RemoveBlockableObject(); //for (int i = 0; i < Tile2.tileNeighbors.Count; i++) //{ // Tile2.tileNeighbors[i].UnregisterTowerListenerForTower(ref tower); // Tile2.tileNeighbors[i].UnregisterTowerListenerForUnit(ref tower); //} //AStar2.UpdateWalkableNeighborsForTileID(Tile2.ID); //for (int j = 0; j < bases.Count; j++) //{ // for (int i = 0; i < bases.Count; i++) // { // if (i != j) // { // bases[i].Tile.UpdatePathTo(bases[j].Tile); // } // } //} return false; }