Ejemplo n.º 1
0
        public void SaveGame()
        {
            foreach (Component module in _gameModules.Values)
            {
                (module as IEngineModule).CleanupBeforeSave();
            }

            BaseSceneObject[] sds = GameObject.FindObjectsOfType <BaseSceneObject>();
            foreach (BaseSceneObject sd in sds)
            {
                sd.SaveGame(TheGameState);
            }

            foreach (Component module in _gameModules.Values)
            {
                (module as IEngineModule).OnSave(TheGameState);
            }

            ActiveObjectsManager.Instance.SaveGame(TheGameState);
            if (EJRConsts.Instance["usePlayerController"] == "true")
            {
                ThePlayerController.SaveGame(TheGameState);
            }
            SettingsManager.Instance.SaveGame(TheGameState);
            TheGameState.SaveGame();
        }
Ejemplo n.º 2
0
        private Dictionary <string, Component> _gameModules;     //loaded game Modules

        public void LoadGame()
        {
            if (IsModuleLoaded("EndlessWorld"))
            {
                EndlessWorldModuleManager.Instance.TheMapManager.LoadMap(false);           //not depending from game state loading, but it's a part of loading process
            }
            TheGameState.LoadGame();
            ActiveObjectsManager.Instance.LoadGame(TheGameState);       //AOM przed WM
            SettingsManager.Instance.LoadGame(TheGameState);

            foreach (Component module in _gameModules.Values)
            {
                (module as IEngineModule).OnLoad(TheGameState);
            }

            if (EJRConsts.Instance["usePlayerController"] == "true")
            {
                ThePlayerController.LoadGame(TheGameState);
            }

            if (IsModuleLoaded("FPPGame"))
            {
                FPPGame.UI.FPPUIManager.Instance.AfterGameLoad();
            }
            _worldLoadingBioms = IsModuleLoaded("EndlessMap") ? true : false;

            foreach (ABInfo abInfo in EJRConsts.Instance.AssetBundlesToLoad)
            {
                foreach (string objName in abInfo.ObjectsToLoad)
                {
                    GetComponent <PrefabPool>().GetPrefab(objName, false);
                }
            }


            IsGameLoaded = true;
        }
Ejemplo n.º 3
0
 //player died and the game needs to be restarted
 public void RestartAfterDeath()
 {
     TheGameState.ClearAllKeys();
     TheGameState.SaveGame();
     StartManager.Instance.ReloadGame();
 }