Пример #1
0
    public void SetBaseCity()
    {
        int chunk = Randomize.GetRandomInt(0, hexGridChunk.Length - 1);
        int cell  = Randomize.GetRandomInt(0, 24);

        while (hexGridChunk[chunk].cells[cell].neighbors.Length != 6)
        {
            Debug.Log("Try to find new tile");
            cell = Randomize.GetRandomInt(0, 24);
        }
        //放置城镇中心,2,0,0
        hexGrid.SetTile(hexGridChunk[chunk].cells[cell], 2, 0, 0, 1);
        hexGridChunk[chunk].cells[cell].isVisible   = true;
        hexGridChunk[chunk].cells[cell].visionField = 0;

        hexMapCamera.AdjustPosition(hexGridChunk[chunk].cells[cell].transform.localPosition);
        HexMapCamera.ValidatePostion();

        for (int i = 0; i < 6; i++)
        {
            if (hexGridChunk[chunk].cells[cell].neighbors[i].tileType == (TileType)0)
            {
                hexGrid.SetTile(hexGridChunk[chunk].cells[cell].neighbors[i], 2, 0, Randomize.GetRandomInt(1, 4), 1);
                hexGridChunk[chunk].cells[cell].neighbors[i].isVisible   = true;
                hexGridChunk[chunk].cells[cell].neighbors[i].visionField = 1;
            }
        }
    }