Beispiel #1
0
    public void AddCity(City newCity)
    {
        if (cityInMyCell)
        {
            throw new UnityException("Tile already has a city!");
        }

        cityInMyCell  = newCity;
        cityIBelongTo = newCity;

        //start by making a city have all of the neighbor hexes within the borders
        for (HexDirection direction = HexDirection.NE; direction <= HexDirection.NW; direction++)
        {
            HexCell neighbor = GetNeighbor(direction);
            if (neighbor != null)
            {
                cityInMyCell.AddCellToTerritory(neighbor);
                neighbor.AddCityToWhichIBelong(cityInMyCell);
                friendlyEdge[(int)direction] = true;
                neighbors[(int)direction].RefreshSelfOnly();
                RefreshSelfOnly();
            }
        }
    }