Example #1
0
        private void OnApplicationQuit()
        {
            ForEachGameSystem(system => system.PreShutdown());
            ForEachGameSystem(system => system.Shutdown());
            ForEachGameSystem(system => system.PostShutdown());

            GameMessenger.Broadcast(GameQuitEvent);
        }
Example #2
0
        protected override void Awake()
        {
            OnGameInitializationStarted();


            Database = InitializeDatabase();

            GameSystems = new List <IGameSystem>();
            GameSystems.AddRange(InitializeBuiltinGameSystems());
            GameSystems.AddRange(InitializeCustomGameSystems());

            ForEachGameSystem(system => system.PreLoad());
            ForEachGameSystem(system => system.Load());
            ForEachGameSystem(system => system.PostLoad());


            GameMessenger.Broadcast(GameEntryEvent);
            OnGameInitializationComplete();
        }
Example #3
0
        public override void Load()
        {
            LastSessionStartDate = GameCore.Instance.Database.GetDate(Keys.LastSessionStartDate);
            LastSessionEndDate   = GameCore.Instance.Database.GetDate(Keys.LastSessionEndDate);

            if (LastSessionStartDate != null && LastSessionEndDate != null)
            {
                LastSessionDuration = LastSessionEndDate.Value - LastSessionStartDate.Value;
            }

            LastSessionVersion = GameCore.Instance.Database.GetVersion(Keys.LastSessionVersion);

            GameCore.Instance.Database.SetDate(Keys.CurrentSessionDate, DateTime.Now);
            GameCore.Instance.Database.SetVersion(Keys.CurrentSessionVersion, GameCore.Instance.GameVersion);

            GameCore.Instance.Database.SetDate(Keys.LastSessionStartDate, DateTime.Now);
            GameCore.Instance.Database.SetVersion(Keys.LastSessionVersion, GameCore.Instance.GameVersion);

            if (LastSessionVersion != GameCore.Instance.GameVersion)
            {
                GameMessenger.Broadcast(SessionsVersionsChangedEvent, LastSessionVersion, GameCore.Instance.GameVersion);
            }
        }