Example #1
0
        private void PhaseTick()
        {
            bool flag = false;

            for (int index = 0; index < 2; ++index)
            {
                MissionAgentSpawnLogic.SpawnPhase activePhaseForSide = this.GetActivePhaseForSide((BattleSideEnum)index);
                activePhaseForSide.NumberActiveTroops = this._missionSides[index].NumberOfActiveTroops;
                if (activePhaseForSide.NumberActiveTroops == 0 && activePhaseForSide.RemainingSpawnNumber == 0 && this._phases[index].Count > 1)
                {
                    this._phases[index].Remove(activePhaseForSide);
                    if (this.GetActivePhaseForSide((BattleSideEnum)index) != null)
                    {
                        flag = true;
                        if (this._onPhaseChanged[index] != null)
                        {
                            this._onPhaseChanged[index]();
                        }
                        Debug.Print("New spawn phase!", color: Debug.DebugColor.Green, debugFilter: 64UL);
                    }
                }
            }
            if (!flag || !this.Mission.IsDeploymentPlanMade())
            {
                return;
            }
            this.Mission.UnmakeDeploymentPlan();
        }
Example #2
0
 public void AddPhase(BattleSideEnum side, int totalSpawn, int initialSpawn)
 {
     MissionAgentSpawnLogic.SpawnPhase spawnPhase = new MissionAgentSpawnLogic.SpawnPhase()
     {
         TotalSpawnNumber     = totalSpawn,
         InitialSpawnNumber   = initialSpawn,
         RemainingSpawnNumber = totalSpawn - initialSpawn
     };
     this._phases[(int)side].Add(spawnPhase);
     this._numberOfTroopsInTotal[(int)side] += totalSpawn;
 }
Example #3
0
 private bool CheckInitialSpawns()
 {
     if (!this.IsInitialSpawnOver)
     {
         if (!this.Mission.IsDeploymentPlanMade())
         {
             for (int index1 = 0; index1 < 2; ++index1)
             {
                 MissionAgentSpawnLogic.SpawnPhase activePhaseForSide = this.GetActivePhaseForSide((BattleSideEnum)index1);
                 if (activePhaseForSide.InitialSpawnNumber > 0 && this._missionSides[index1].TroopSpawningActive)
                 {
                     this._missionSides[index1].PreSupplyTroops(activePhaseForSide.InitialSpawnNumber);
                     this._missionSides[index1].GetPreSuppliedFormationTroopCounts(this._numberOfTroopsToSpawnPerSideFormation);
                     for (int index2 = 0; index2 < this._numberOfTroopsToSpawnPerSideFormation.Length; ++index2)
                     {
                         if (this._numberOfTroopsToSpawnPerSideFormation[index2] > 0)
                         {
                             this.Mission.AddTroopsToDeploymentPlan((BattleSideEnum)index1, (FormationClass)index2, this._numberOfTroopsToSpawnPerSideFormation[index2]);
                         }
                     }
                 }
             }
             this.Mission.MakeDeploymentPlan();
         }
         List <int> intList = new List <int>();
         for (int index = 0; index < 2; ++index)
         {
             MissionAgentSpawnLogic.SpawnPhase activePhaseForSide = this.GetActivePhaseForSide((BattleSideEnum)index);
             if (activePhaseForSide.InitialSpawnNumber > 0 && this._missionSides[index].TroopSpawningActive)
             {
                 this._missionSides[index].SpawnTroops(activePhaseForSide.InitialSpawnNumber, false, true);
                 this.GetActivePhaseForSide((BattleSideEnum)index).OnInitialTroopsSpawned();
                 intList.Add(index);
             }
         }
         if (this.IsInitialSpawnOver)
         {
             foreach (int index in intList)
             {
                 this._missionSides[index].OnInitialSpawnOver();
                 this.OnInitialSpawnForSideEnded((BattleSideEnum)index);
             }
         }
     }
     return(this.IsInitialSpawnOver);
 }