예제 #1
0
    protected override IEnumerator OnInitialize()
    {
        this.descriptorsDatabase = Databases.GetDatabase <SimulationDescriptor>(false);
        Diagnostics.Assert(this.descriptorsDatabase != null);
        this.gameService = Services.GetService <IGameService>();
        Diagnostics.Assert(this.gameService != null);
        this.endTurnService = Services.GetService <IEndTurnService>();
        Diagnostics.Assert(this.endTurnService != null);
        this.eventService = Services.GetService <IEventService>();
        Diagnostics.Assert(this.eventService != null);
        this.eventService.EventRaise    += this.EventService_EventRaise;
        this.gameEntityRepositoryService = this.gameService.Game.Services.GetService <IGameEntityRepositoryService>();
        Diagnostics.Assert(this.gameEntityRepositoryService != null);
        this.gameEntityRepositoryService.GameEntityUnregistered += this.GameEntityRepositoryService_GameEntityUnregistered;
        this.seasonService = this.gameService.Game.Services.GetService <ISeasonService>();
        Diagnostics.Assert(this.seasonService != null);
        this.worldPositionningService = this.gameService.Game.Services.GetService <IWorldPositionningService>();
        Diagnostics.Assert(this.worldPositionningService != null);
        KaijuCouncil.StaticInitialize();
        KaijuCouncil.PreComputeAttractiveness();
        base.Empire.RegisterPass("GameServerState_Turn_Begin", "KaijuCouncilServerTurnBegin", new Agency.Action(this.GameServerState_Turn_Begin), new string[0]);
        base.Empire.RegisterPass("GameServerState_Turn_End", "KaijuCouncilServerTurnEnd", new Agency.Action(this.GameServerState_Turn_End), new string[0]);
        base.Empire.RegisterPass("GameClientState_Turn_Begin", "KaijuCouncilClientTurnBegin", new Agency.Action(this.GameClientState_Turn_Begin), new string[0]);
        base.Empire.RegisterPass("GameClientState_Turn_End", "KaijuCouncilClientTurnEnd", new Agency.Action(this.GameClientState_Turn_End), new string[0]);
        this.departmentOfDefense   = base.Empire.GetAgency <DepartmentOfDefense>();
        this.departmentOfEducation = base.Empire.GetAgency <DepartmentOfEducation>();
        this.ResetRelocationETA();
        yield return(base.OnInitialize());

        yield break;
    }
예제 #2
0
    protected override IEnumerator OnLoadGame(Amplitude.Unity.Game.Game game)
    {
        yield return(base.OnLoadGame(game));

        KaijuCouncil.StaticInitialize();
        KaijuCouncil.PreComputeAttractiveness();
        if (this.Kaiju != null)
        {
            yield return(this.Kaiju.OnLoadGame(game));

            this.gameEntityRepositoryService.Register(this.Kaiju);
            base.Empire.AddChild(this.Kaiju);
            base.Empire.Refresh(false);
        }
        this.ComputeTameCosts(game as global::Game);
        KaijuCouncil.UpdateTameCosts();
        this.ELCPTameCostCooldown = this.ELCPCalculateTameCostCooldown();
        yield break;
    }