예제 #1
0
        public LevelDirector.UnitWave Calculate(int wave, GameUnitManager.UnitInfo towerUnitInfo, GameUnitManager.UnitInfo monsterUnitInfo)
        {
            int combinationNum = Random.Range(3, 6);

            LevelDirector.UnitWave unitWave = new LevelDirector.UnitWave();
            unitWave.phaseStructure = new LevelDirector.UnitStructure[combinationNum];
            int overallWarFieldScore = towerUnitInfo.value + monsterUnitInfo.value;

            for (int i = 0; i < combinationNum; i++)
            {
                int spawnDelayTime = Random.Range(8, 15);

                float modifier = Graph.Linear(Graph.Normalized(i + 1, combinationNum), 1, 0.5f);
                LevelDirector.UnitStructure unitStructure = new LevelDirector.UnitStructure();
                unitStructure.unitArray = new LevelDirector.Units[2];

                unitStructure.unitArray[0].monsterStats = PhaseUtility.FindMonsterByStrategy(_monsterStats, VariableFlag.Strategy.CastleFirst);
                unitStructure.unitArray[0].spawnNum     = PhaseUtility.FindMonsterNum(15, 30, modifier);

                unitStructure.unitArray[1].monsterStats = PhaseUtility.FindMonsterByStrategy(_monsterStats, VariableFlag.Strategy.CastleFirst);
                unitStructure.unitArray[1].spawnNum     = PhaseUtility.FindMonsterNum(15, 25, modifier);

                unitStructure.timeToNextWave = spawnDelayTime;
                unitWave.phaseStructure[i]   = unitStructure;
            }

            return(unitWave);
        }
예제 #2
0
        private void BuildWaveStructure(Phase phaseType)
        {
            PhaseInterface findPhaseInterface = null;

            GameUnitManager.UnitInfo towerInfo = _gameUnitManager.GetUnitCount(VariableFlag.Pooling.TowerID);
            GameUnitManager.UnitInfo unitInfo  = _gameUnitManager.GetUnitCount(VariableFlag.Pooling.MonsterID);

            if (_phaseInterfaceDict.TryGetValue(phaseType, out findPhaseInterface))
            {
                findPhaseInterface.SetUp(_monsterStats);

                _UnitWave = findPhaseInterface.Calculate(WaveLength, towerInfo, unitInfo);

                WaveCombination       = 0;
                WaveCombinationLength = _UnitWave.phaseStructure.Length;

                return;
            }
            ;

            WaveCombination       = 0;
            WaveCombinationLength = 0;

            _UnitWave = default(UnitWave);
        }
예제 #3
0
        public void OnUpdate()
        {
            unitInfo = _gameUnitManager.GetUnitCount(VariableFlag.Pooling.MonsterID);

            if (PullingTimeRecord < LevelDesignManager.Time)
            {
                CheckReinforcement();
            }
        }