protected override void ExecuteNeeds(StaticString context, StaticString pass) { base.ExecuteNeeds(context, pass); if (!DepartmentOfTheInterior.CanInvokePillarsAndSpells(base.AIEntity.Empire)) { return; } this.MoneyAtTurnBegin = 0f; if (base.AIEntity.Empire.GetPropertyValue("PillarsCount") < 1f) { this.departmentOfTheTreasury.TryGetResourceStockValue(base.AIEntity.Empire.SimulationObject, DepartmentOfTheTreasury.Resources.EmpireMoney, out this.MoneyAtTurnBegin, false); AIScheduler.Services.GetService <ISynchronousJobRepositoryAIHelper>().RegisterSynchronousJob(new SynchronousJob(this.SynchronousJob_StartValidatedBoosters)); } }
public override IEnumerator Initialize(AIEntity aiEntity) { yield return(base.Initialize(aiEntity)); if (!DepartmentOfTheInterior.CanInvokePillarsAndSpells(base.AIEntity.Empire)) { yield break; } this.aiEntityCity = (base.AIEntity as AIEntity_City); IGameService gameService = Services.GetService <IGameService>(); this.pillarService = gameService.Game.Services.GetService <IPillarService>(); this.worldPositioningService = gameService.Game.Services.GetService <IWorldPositionningService>(); this.decisionMaker = new SimulationDecisionMaker <PillarDefinition>(this, this.aiEntityCity.City.Empire.SimulationObject); this.decisionMaker.ParameterContextModifierDelegate = new Func <PillarDefinition, StaticString, float>(this.DecisionParameterContextModifier); this.decisionMaker.ParameterContextNormalizationDelegate = new DecisionMaker <PillarDefinition, InterpreterContext> .GetNormalizationRangeDelegate(this.DecisionParameterContextNormalization); base.AIEntity.RegisterPass(AIEntity.Passes.CreateLocalNeeds.ToString(), "LayerPillar_CreateLocalNeedsPass", new AIEntity.AIAction(this.CreateLocalNeeds), this, new StaticString[0]); base.AIEntity.RegisterPass(AIEntity.Passes.ExecuteNeeds.ToString(), "LayerPillar_ExecuteNeedsPass", new AIEntity.AIAction(this.ExecuteNeeds), this, new StaticString[0]); this.pillarEffectsAiParameters = new Dictionary <StaticString, IAIParameter <InterpreterContext>[]>(); this.aiParameterConverterDatabase = Databases.GetDatabase <AIParameterConverter>(false); yield break; }