Example #1
0
    private void Update()
    {
        if (isCity && spawnHumanCD.IsFinished)
        {
            Tile tile;

            if (createMap.FindGrass((int)transform.position.x, (int)transform.position.y, out tile))
            {
                GameObject newHuman = Instantiate(human, transform.position, Quaternion.identity);

                newHuman.GetComponent <Human>().SetHome = transform.position;

                newHuman.GetComponent <Human>().SetDestiny = tile;
            }
            else if (createMap.SetToDesert((int)transform.position.x, (int)transform.position.y, out tile))
            {
                GameObject newHuman = Instantiate(human, transform.position, Quaternion.identity);

                newHuman.GetComponent <Human>().SetHome = transform.position;

                newHuman.GetComponent <Human>().SetDestiny = tile;
            }

            spawnHumanCD.Restart();
        }
        else if (isDesert && transformToCityCD.IsFinished)
        {
            SetToCity();
        }
    }