示例#1
0
    public void _SelectUpgradeUI()
    {
        int       id = selectedTower.GetTowerID();
        UnitTower upgradeTower;

        upgradeTower = FindUpgrade(id);
        if (upgradeTower != null)
        {
            GameObject obj;
            PoolManager.Unspawn(selectedTower.transform);
            GameManager.ClearIndicator();
            obj = PoolManager.Spawn(upgradeTower.transform, selectedTower.transform.position, Quaternion.identity);
            ScoreControl.CoinDecrease(selectedTower.baseTower.upgradeCost);
            obj.GetComponent <SpriteRenderer>().sortingLayerName = selectedTower.GetComponent <SpriteRenderer>().sortingLayerName;
            AudioManager.PlayTowerBuilding();
            GameManager.ClearUpgradeUI();
            GameManager.ClearDismantleUI();
            selectedTower = null;
        }
        if (upgradeTower == null)
        {
            GameManager.ClearUpgradeUI();
            GameManager.ClearDismantleUI();
            selectedTower = null;
        }
    }
示例#2
0
    public GameObject _Select(GameObject icon)
    {
        int id = ReadFromExcel.ExtractInt(icon.name);

        foreach (UnitTower tower in towers)
        {
            if (ReadFromExcel.ExtractInt(tower.name) == id)
            {
                //Vector3 pos = new Vector3 (0, 0, 0);
                GameObject obj;
                obj = PoolManager.Spawn(tower.gameObject, selectedFlag.transform.position, Quaternion.identity);
                ScoreControl.CoinDecrease(tower.baseTower.cost);
                obj.GetComponent <SpriteRenderer>().sortingLayerName = selectedFlag.GetComponent <SpriteRenderer>().sortingLayerName;
                //GameManager.ShowIndicator(obj.GetComponent<UnitTower>());
                //GameManager.ClearBaseBuildings();
                //buildManager.ClearBuildPoint();
                AudioManager.PlayTowerBuilding();
                PoolManager.Unspawn(selectedFlag);
                selectedFlag = null;
                break;
            }
        }

        //PoolManager.Spawn(
        selectedIcon = icon;

        return(selectedIcon);
    }