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(); } } } }
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 virtual void AddCommander(AICommander commander) { if (this.IsActive()) { commander.Initialize(); commander.Load(); commander.CreateMission(); this.aiCommanders.Add(commander); } }
public override void ReadXml(XmlReader reader) { base.ReadXml(reader); if (!reader.IsStartElement("Commanders")) { return; } if (reader.IsStartElement("Commanders") && reader.IsEmptyElement()) { reader.Skip(); return; } reader.ReadStartElement("Commanders"); while (reader.IsStartElement()) { Type type = Type.GetType(reader.GetAttribute("AssemblyQualifiedName")); if (type == null) { reader.Skip(); } else { AICommander aicommander = Activator.CreateInstance(type, true) as AICommander; if (aicommander == null) { reader.Skip(); } else { aicommander.Empire = base.AIEntity.Empire; aicommander.AIPlayer = base.AIEntity.AIPlayer; aicommander.Initialize(); reader.ReadElementSerializable <AICommander>(ref aicommander); this.aiCommanders.Add(aicommander); } } } reader.ReadEndElement("Commanders"); }
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(); } } }