Example #1
0
    private void Awake()
    {
        Application.targetFrameRate = 60;

        var random = new Random(DateTime.UtcNow.Millisecond);

        UnityEngine.Random.InitState(random.Next());
        Rand.game = new Rand(random.Next());

        _contexts = Contexts.sharedInstance;

        _contexts.config.SetGameConfig(_gameConfig);

//        _contexts.gameState.isInitialization = true;

        _updateSystems      = new UpdateSystems(_contexts);
        _fixedUpdateSystems = new FixedUpdateSystems(_contexts);
        _lateUpdateSystems  = new LateUpdateSystems(_contexts);

        _updateSystems.ActivateReactiveSystems();
        _fixedUpdateSystems.ActivateReactiveSystems();
        _lateUpdateSystems.ActivateReactiveSystems();

        _updateSystems.Initialize();
        _fixedUpdateSystems.Initialize();
        _lateUpdateSystems.Initialize();
    }
        public override void Init()
        {
            foreach (var module in _modules)
            {
                module.Init();
            }


            foreach (var module in _modules)
            {
                ModuleInitSystems.AddRange(module.ModuleInitSystems);
                EntityInitSystems.AddRange(module.EntityInitSystems);
                PlaybackSystems.AddRange(module.PlaybackSystems);
                UserCmdExecuteSystems.AddRange(module.UserCmdExecuteSystems);


                ResourceLoadSystems.AddRange(module.ResourceLoadSystems);

                GameStateUpdateSystems.AddRange(module.GameStateUpdateSystems);

                PhysicsInitSystems.AddRange(module.PhysicsInitSystems);
                PhysicsUpdateSystems.AddRange(module.PhysicsUpdateSystems);
                PhysicsPostUpdateSystems.AddRange(module.PhysicsPostUpdateSystems);

                GizmosRenderSystems.AddRange(module.GizmosRenderSystems);
                RenderSystems.AddRange(module.RenderSystems);

                EntityCleanUpSystems.AddRange(module.EntityCleanUpSystems);

                LateUpdateSystems.AddRange(module.LateUpdateSystems);
                OnGUISystems.AddRange(module.OnGUISystems);
                GamePlaySystems.AddRange(module.GamePlaySystems);
                UiSystems.AddRange(module.UiSystems);
                UiHfrSystems.AddRange(module.UiHfrSystems);
                VehicleCmdExecuteSystems.AddRange(module.VehicleCmdExecuteSystems);
            }
        }