Example #1
0
        private void OnLevelWasLoaded()
        {
            if (KickStarter.settingsManager.IsInLoadingScene ())
            {
                return;
            }

            if (KickStarter.sceneSettings == null)
            {
                return;
            }

            ResetSceneObjects ();
            if (loadingGame == LoadingGame.InNewScene || loadingGame == LoadingGame.InSameScene)
            {
                if (KickStarter.dialog)
                {
                    KickStarter.dialog.KillDialog (true, true);
                }

                if (KickStarter.playerInteraction)
                {
                    KickStarter.playerInteraction.StopMovingToHotspot ();
                }

                ReturnMainData ();
                KickStarter.levelStorage.ReturnCurrentLevelData (true);
                CustomLoadHook ();

                /*if (loadingGame == LoadingGame.InSameScene)
                {
                    loadingGame = LoadingGame.No;
                }*/
            }

            if (KickStarter.runtimeInventory)
            {
                KickStarter.runtimeInventory.RemoveRecipes ();
            }

            if (loadingGame == LoadingGame.JustSwitchingPlayer)
            {
                foreach (PlayerData _data in saveData.playerData)
                {
                    if (_data.playerID == KickStarter.player.ID)
                    {
                        ReturnCameraData (_data);
                        break;
                    }
                }

                KickStarter.sceneSettings.UnpauseGame (KickStarter.playerInput.timeScale);//
                KickStarter.stateHandler.gameState = GameState.Cutscene;
                KickStarter.mainCamera.FadeIn (0.5f);

                Invoke ("ReturnToGameplay", gameplayInvokeTime);
            }
            else
            {
                activeSelectiveLoad = new SelectiveLoad ();
            }

            AssetLoader.UnloadAssets ();
        }
Example #2
0
 /**
  * <summary>Sets the local instance of SelectiveLoad, which determines which save data is restored the next time (and only the next time) LoadGame is called.</summary>
  * <param name = "selectiveLoad">An instance of SelectiveLoad the defines what elements to load</param>
  */
 public void SetSelectiveLoadOptions(SelectiveLoad selectiveLoad)
 {
     activeSelectiveLoad = selectiveLoad;
 }