Ejemplo n.º 1
0
    public void AddCity(int cellIndex, int citySize, bool isMyCity)
    {
        HexCell current = hexGrid.GetCell(cellIndex);

        if (current)
        {
            current.Walled     = true;
            current.UrbanLevel = 3;
            current.ClearRes(); // 把城内的其它资源都干掉
            current.IncreaseVisibility();
            if (citySize == 1)  // 大号城市,大了一圈
            {
                for (HexDirection d = HexDirection.NE; d <= HexDirection.NW; d++)
                {
                    HexCell neighbor = current.GetNeighbor(d);
                    if (neighbor)
                    {
                        neighbor.Walled     = true;
                        neighbor.UrbanLevel = Random.Range(2, 3);
                        neighbor.ClearRes();
                        neighbor.IncreaseVisibility();
                    }
                }
            }
        }
    }