Example #1
0
        private void DeployNextWave(uint id, object cookie)
        {
            this.timers.Remove(id);
            this.currentWaveIndex    = this.wavesDeployed;
            this.currentWave         = this.waves[this.currentWaveIndex];
            this.waveDirectionOffset = ((!this.randomizeWaves) ? 0 : Service.Rand.SimRange(0, 360));
            List <DefenseTroopGroup> list = DefensiveBattleController.ParseTroopGroups(this.currentWave.Encounter.Uid, this.currentWave.Encounter.WaveGroup, this.waveDirectionOffset);
            int count = list.Count;

            for (int i = 0; i < count; i++)
            {
                DefenseTroopGroup defenseTroopGroup = list[i];
                this.timers.Add(this.timerManager.CreateSimTimer(defenseTroopGroup.Seconds * 1000u, false, new TimerDelegate(this.DeployGroupAfterDelay), defenseTroopGroup));
            }
            this.wavesDeployed++;
        }
 private void EndCurrentWave()
 {
     this.currentWave = null;
     if (this.wavesDeployed < this.waveCount)
     {
         uint delay = (uint)(this.waves[this.currentWaveIndex + 1].Delay * 1000f);
         this.timers.Add(this.timerManager.CreateSimTimer(delay, false, new TimerDelegate(this.DeployNextWave), null));
         Lang   lang         = Service.Get <Lang>();
         string instructions = lang.Get("NEXT_WAVE_IN", new object[]
         {
             (int)this.waves[this.currentWaveIndex + 1].Delay
         });
         Service.Get <UXController>().MiscElementsManager.ShowPlayerInstructions(instructions, 3f, 2f);
         return;
     }
     this.AllWavesClear = true;
 }
Example #3
0
        public static List <DefenseWave> ParseWaves(string waveData)
        {
            List <DefenseWave> list = new List <DefenseWave>();

            string[] array = waveData.Split(new char[]
            {
                ' '
            });
            for (int i = 0; i < array.Length; i += 2)
            {
                float delay = 0f;
                if (i != 0)
                {
                    delay = Convert.ToSingle(array[i - 1]);
                }
                DefenseWave item = new DefenseWave(array[i], delay);
                list.Add(item);
            }
            return(list);
        }
        public void StartDefenseMissionAfterLoadingAssets(CampaignMissionVO mission)
        {
            DefenseWave defenseWave         = this.waves[this.currentWaveIndex];
            List <DefenseTroopGroup> list   = DefensiveBattleController.ParseTroopGroups(defenseWave.Encounter.Uid, defenseWave.Encounter.WaveGroup, 0);
            int                count        = list.Count;
            AssetManager       assetManager = Service.Get <AssetManager>();
            List <string>      list2        = new List <string>();
            List <object>      list3        = new List <object>();
            List <AssetHandle> list4        = new List <AssetHandle>();

            for (int i = 0; i < count; i++)
            {
                DefenseTroopGroup defenseTroopGroup = list[i];
                TroopTypeVO       troopTypeVO       = this.sdc.Get <TroopTypeVO>(defenseTroopGroup.TroopUid);
                list2.Add(troopTypeVO.AssetName);
                list3.Add(new InternalLoadCookie(troopTypeVO.AssetName));
                list4.Add(AssetHandle.Invalid);
            }
            assetManager.MultiLoad(list4, list2, null, null, null, new AssetsCompleteDelegate(this.StartDefenseMissionAfterPreload), mission);
        }