예제 #1
0
    void SpawnEnemy()
    {
        DefenseGameTile spawnPoint = board.GetSpawnPoint(Random.Range(0, board.SpawnPointCount));
        Enemy           enemy      = enemyFactory.Get();

        enemy.SpawnOn(spawnPoint);
        enemies.Add(enemy);
    }
예제 #2
0
 public static void MakeNorthSouthNeighbors(DefenseGameTile north, DefenseGameTile south)
 {
     Debug.Assert(
         south.north == null && north.south == null, "Redefined neighbors!"
         );
     south.north = north;
     north.south = south;
 }
예제 #3
0
 public static void MakeEastWestNeightbors(DefenseGameTile east, DefenseGameTile west)
 {
     Debug.Assert(
         west.east == null && east.west == null, "Redefined neightbors!"
         );
     west.east = east;
     east.west = west;
 }
예제 #4
0
    void HandleTouch()
    {
        DefenseGameTile tile = board.GetTile(TouchRay);

        if (tile != null)
        {
            board.ToggleWall(tile);
        }
    }
예제 #5
0
 DefenseGameTile GrowPathTo(DefenseGameTile neighbor, Direction direction)
 {
     Debug.Assert(HasPath, "No Path!");
     if (neighbor == null || neighbor.HasPath)
     {
         return(null);
     }
     neighbor.PathDirection = direction;
     neighbor.distance      = distance + 1;
     neighbor.nextOnPath    = this;
     // neighbor.ExitPoint=neighbor.transform.localPosition + direction.GetHalfVector();
     neighbor.ExitPoint =
         (neighbor.transform.localPosition + transform.localPosition) * 0.5f;
     return(neighbor.Content.Type != GameTileContentType.Wall?neighbor:null);
 }
예제 #6
0
    void HandleAlternativeTouch()
    {
        DefenseGameTile tile = board.GetTile(TouchRay);

        if (tile != null)
        {
            if (Input.GetKey(KeyCode.LeftShift))
            {
                board.ToggleDestination(tile);
            }
            else
            {
                board.ToggleSpawnPoint(tile);
            }
        }
    }