Esempio n. 1
0
    static private SkillStats[] GetSkillFromIDs(StatsHolder statsHolder, string[] skillArray)
    {
        SkillStats[] skillStats = new SkillStats[skillArray.Length];

        for (int k = 0; k < skillArray.Length; k++)
        {
            SkillStats findObject = statsHolder.FindObject <SkillStats>(skillArray[k]);

            if (findObject != null)
            {
                skillStats[k] = findObject;
            }
        }

        return(skillStats);
    }
Esempio n. 2
0
    static private TowerStats UpdateTowerUpgradePath(TowerStats c_prefab, StatsHolder statsHolder, string[] upgradePathArray)
    {
        c_prefab.upgrade_path = new TowerStats[upgradePathArray.Length];

        for (int k = 0; k < upgradePathArray.Length; k++)
        {
            TowerStats findObject = statsHolder.FindObject <TowerStats>(upgradePathArray[k]);

            if (findObject != null)
            {
                c_prefab.upgrade_path[k] = findObject;
                findObject.AddValue(c_prefab.cost);
            }
        }

        return(c_prefab);
    }
Esempio n. 3
0
        private async void SelectTowerToBuild(string tower_id)
        {
            if (IsTileNodeValid(currentSelectedNode))
            {
                TowerStats towerStats = _statHolder.FindObject <TowerStats>(tower_id);

                //No money
                if (_levelDesignManager.selfPlayer.capital < towerStats.cost)
                {
                    return;
                }


                var tower = PoolManager.instance.ReuseObject(VariableFlag.Pooling.TowerID);

                if (tower != null)
                {
                    tower.transform.position = currentSelectedNode.WorldSpace;

                    BlockComponent mapBlock  = _mapBlockManager.GetMapComponentByPos(currentSelectedNode.WorldSpace);
                    STPTower       stpTower  = _stpTheme.FindObject <STPTower>(VariableFlag.Pooling.TowerID);
                    TowerUnit      towerUnit = tower.GetComponent <TowerUnit>();

                    if (stpTower != null && towerUnit != null && mapBlock != null && towerStats != null)
                    {
                        tower.transform.SetParent(mapBlock.unitHolder);
                        towerUnit.SetUp(towerStats, stpTower,
                                        _mapGrid, _levelDesignManager.selfPlayer,
                                        (UnitInterface projectile, GameDamageManager.DMGRegistry dmgRistry) =>
                        {
                            _gameUnitManager.AddUnit(projectile);
                            _gameUnitManager.gameDamageManager.AddRequest(dmgRistry);
                        });

                        _gameUnitManager.AddUnit(towerUnit);
                        isTaskDone = true;
                    }
                }
            }
        }