private void Order_KaijuRisen(object sender, TicketRaisedEventArgs e)
 {
     if (e.Result == PostOrderResponse.Processed)
     {
         OrderKaijuChangeMode orderKaijuChangeMode = e.Order as OrderKaijuChangeMode;
         Kaiju kaiju = null;
         if (!this.gameEntityRepositoryService.TryGetValue <Kaiju>(orderKaijuChangeMode.KaijuGUID, out kaiju) || !this.MajorEmpire.TamedKaijus.Contains(kaiju))
         {
             return;
         }
         AICommander aicommander = this.aiCommanders.Find((AICommander match) => match.ForceArmyGUID == kaiju.KaijuArmy.GUID);
         if (aicommander == null)
         {
             this.AddCommander(new AICommander_KaijuSupport
             {
                 ForceArmyGUID = kaiju.KaijuArmy.GUID,
                 Empire        = base.AIEntity.Empire,
                 AIPlayer      = base.AIEntity.AIPlayer
             });
             return;
         }
         aicommander.Initialize();
         aicommander.Load();
         aicommander.CreateMission();
     }
 }
 protected override void RefreshObjectives(StaticString context, StaticString pass)
 {
     base.RefreshObjectives(context, pass);
     for (int i = 0; i < this.MajorEmpire.TamedKaijus.Count; i++)
     {
         Kaiju kaiju = this.MajorEmpire.TamedKaijus[i];
         if (kaiju.OnArmyMode())
         {
             AICommander aicommander = this.aiCommanders.Find((AICommander match) => match.ForceArmyGUID == kaiju.KaijuArmy.GUID);
             if (aicommander == null)
             {
                 this.AddCommander(new AICommander_KaijuSupport
                 {
                     ForceArmyGUID = kaiju.KaijuArmy.GUID,
                     Empire        = base.AIEntity.Empire,
                     AIPlayer      = base.AIEntity.AIPlayer
                 });
             }
             else
             {
                 aicommander.Initialize();
                 aicommander.Load();
                 aicommander.CreateMission();
             }
         }
     }
 }
Beispiel #3
0
 protected virtual void AddCommander(AICommander commander)
 {
     if (this.IsActive())
     {
         commander.Initialize();
         commander.Load();
         commander.CreateMission();
         this.aiCommanders.Add(commander);
     }
 }
 private void AILayer_KaijuManagement_TamedKaijusCollectionChanged(object sender, CollectionChangeEventArgs e)
 {
     if (e.Action == CollectionChangeAction.Add && this.IsActive())
     {
         Kaiju kaiju = e.Element as Kaiju;
         if (kaiju != null && this.MajorEmpire.TamedKaijus.Contains(kaiju) && kaiju.OnArmyMode())
         {
             AICommander aicommander = this.aiCommanders.Find((AICommander match) => match.ForceArmyGUID == kaiju.KaijuArmy.GUID);
             if (aicommander == null)
             {
                 this.AddCommander(new AICommander_KaijuSupport
                 {
                     ForceArmyGUID = kaiju.KaijuArmy.GUID,
                     Empire        = base.AIEntity.Empire,
                     AIPlayer      = base.AIEntity.AIPlayer
                 });
                 return;
             }
             aicommander.Initialize();
             aicommander.Load();
             aicommander.CreateMission();
         }
     }
 }