예제 #1
0
        public static void SetTowerForLevelMap(Tower tower, Tile tile)
        {
            tile.SetBlockableObject(tower);

            //UpdateTilePaths();

            List<Tile> walkableNeighbors = GetWalkableNeighbors(tile);

            for (int i = 0; i < walkableNeighbors.Count; i++)
            {
                walkableNeighbors[i].RegisterTowerListener(tower);
            }
            //OnTowerCreated();
        }
예제 #2
0
        public static bool SetTower(Tower tower, Tile tile)
        {
            tile.SetBlockableObject(tower);
            if (IsTilePathsValid())
            {
                UpdateTilePaths();

                List<Tile> walkableNeighbors = GetWalkableNeighbors(tile);

                for (int i = 0; i < walkableNeighbors.Count; i++)
                {
                    walkableNeighbors[i].RegisterTowerListener(tower);
                }
                OnTowerCreated();
                return true;
            }

            RemoveTower(tile);
            return false;
        }