void SpawnEnemy() { DefenseGameTile spawnPoint = board.GetSpawnPoint(Random.Range(0, board.SpawnPointCount)); Enemy enemy = enemyFactory.Get(); enemy.SpawnOn(spawnPoint); enemies.Add(enemy); }
public static void MakeNorthSouthNeighbors(DefenseGameTile north, DefenseGameTile south) { Debug.Assert( south.north == null && north.south == null, "Redefined neighbors!" ); south.north = north; north.south = south; }
public static void MakeEastWestNeightbors(DefenseGameTile east, DefenseGameTile west) { Debug.Assert( west.east == null && east.west == null, "Redefined neightbors!" ); west.east = east; east.west = west; }
void HandleTouch() { DefenseGameTile tile = board.GetTile(TouchRay); if (tile != null) { board.ToggleWall(tile); } }
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); }
void HandleAlternativeTouch() { DefenseGameTile tile = board.GetTile(TouchRay); if (tile != null) { if (Input.GetKey(KeyCode.LeftShift)) { board.ToggleDestination(tile); } else { board.ToggleSpawnPoint(tile); } } }