Exemplo n.º 1
0
    private void CreateTower(Vector3 newPos)
    {
        var tower = objectPooler.GetPooledObject();
        var cost  = tower.GetComponent <TowerController>().cost;

        if (_goldManager.Gold >= cost)
        {
            if (tower == null)
            {
                return;
            }
            _goldManager.RemoveGold(cost);
            tower.transform.position = newPos;
            tower.SetActive(true);
            StartCoroutine(BuildNavMesh());
        }
        else
        {
            StartCoroutine(_goldManager.DisplayErrorText());
        }
    }