Esempio n. 1
0
    public void PopulationPlacement()
    {
        if (!placingPop)
        {
            placingPop = true;
            //this should close when you end the turn
            peoplePlaceableCells = new List <TileCell>();
            //get all tiles that are within 3
            foreach (var zone in ZoneCells)
            {
                foreach (TileCell cell in zone.Value)
                {
                    peoplePlaceableCells.AddRange(grid.CellsInRadius(cell, 3));
                }
            }

            //hide all children
            foreach (Transform child in GameObject.Find("WorldSpaceCanvas").transform.Find("TileUI").transform)
            {
                child.gameObject.SetActive(false);
            }
            foreach (var workableCells in peoplePlaceableCells)
            {
                if (workableCells.feature != TerrainFeature.Mountains && workableCells != cell)
                {
                    workableCells.cellUI.gameObject.SetActive(true);
                    workableCells.cellUI.GetComponent <TextMeshProUGUI>().text = "F:" + cell.tileFoodProduction + " P:" + cell.tileProduction;
                }
            }
        }
        else
        {
            placingPop = false;
            //hide all children
            foreach (Transform child in GameObject.Find("WorldSpaceCanvas").transform.Find("TileUI").transform)
            {
                child.gameObject.SetActive(false);
            }
        }
    }