protected void OnAfterChangeScene(LoadingGame loadingGame) { if (runOnLoad && loadingGame != LoadingGame.No) { if (KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow) { switch (sceneLoadCondition) { case SceneLoadCondition.DueToLoadingSave: if (loadingGame == LoadingGame.JustSwitchingPlayer) { return; } break; case SceneLoadCondition.DueToSwitchingPlayer: if (loadingGame != LoadingGame.JustSwitchingPlayer) { return; } break; default: break; } } RunActionLists(); } }
private void OnAfterChangeScene(LoadingGame loadingGame) { if (runOnLoad && loadingGame != LoadingGame.No) { RunActionLists(); } }
/** * <summary>Triggers the OnAfterChangeScene event.</summary> * <param name = "loadingGame">The current 'loading' state (No, InSameScene, InNewScene, JustSwitchingPlayer</param> */ public void Call_OnAfterChangeScene(LoadingGame loadingGame) { if (OnAfterChangeScene != null) { OnAfterChangeScene(loadingGame); } }
private IEnumerator OnCompleteSceneChange() { LoadingGame loadinggame = KickStarter.saveSystem.loadingGame; int _removeNPCID = removeNPCID; removeNPCID = 0; yield return(new WaitForEndOfFrame()); if (_removeNPCID != 0) { NPC npcToRemove = Serializer.returnComponent <NPC> (_removeNPCID); if (npcToRemove != null) { if (takeNPCPosition) { KickStarter.player.Teleport(npcToRemove.transform.position); KickStarter.player.SetRotation(npcToRemove.TransformRotation); KickStarter.player.transform.localScale = npcToRemove.transform.localScale; } npcToRemove.transform.position += new Vector3(100f, -100f, 100f); } _removeNPCID = 0; } if (KickStarter.eventManager != null) { KickStarter.eventManager.Call_OnAfterChangeScene(loadinggame); } }
public void ReadyToPlay() { if (PhotonNetwork.IsMasterClient) { nbPlayersReady += 1; if (nbPlayersReady == PhotonNetwork.CurrentRoom.PlayerCount) { ProgressCanvas = PhotonNetwork.Instantiate("Progress_Canvas", new Vector3(0, 0, 0), Quaternion.identity); loadingGame = ProgressCanvas.GetComponent <LoadingGame>(); PhotonNetwork.RaiseEvent(EventReady, DateTime.Now.Millisecond, new RaiseEventOptions { Receivers = ReceiverGroup.All }, new SendOptions { Reliability = true }); loadingGame.IncreaseProgress(0.22f); } } }
protected void OnAfterChangeScene(LoadingGame loadingGame) { isLoading = false; loadingProgress = 0f; }
public void LoadSaveGame(int saveID) { string allData = Serializer.LoadSaveFile (GetSaveFileName (saveID), true); if (allData.ToString () != "") { string mainData; string roomData; int divider = allData.IndexOf ("||"); mainData = allData.Substring (0, divider); roomData = allData.Substring (divider + 2); if (SaveSystem.GetSaveMethod () == SaveMethod.XML) { saveData = (SaveData) Serializer.DeserializeObjectXML <SaveData> (mainData); KickStarter.levelStorage.allLevelData = (List<SingleLevelData>) Serializer.DeserializeObjectXML <List<SingleLevelData>> (roomData); } else { saveData = Serializer.DeserializeObjectBinary <SaveData> (mainData); KickStarter.levelStorage.allLevelData = Serializer.DeserializeRoom (roomData); } // Stop any current-running ActionLists, dialogs and interactions KillActionLists (); // If player has changed, destroy the old one and load in the new one if (KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow) { if ((KickStarter.player == null && saveData.mainData.currentPlayerID != KickStarter.settingsManager.GetEmptyPlayerID ()) || (KickStarter.player != null && KickStarter.player.ID != saveData.mainData.currentPlayerID)) { KickStarter.ResetPlayer (GetPlayerByID (saveData.mainData.currentPlayerID), saveData.mainData.currentPlayerID, true, Quaternion.identity); } } int newScene = GetPlayerScene (saveData.mainData.currentPlayerID, saveData.playerData); // Load correct scene if (newScene != Application.loadedLevel) { loadingGame = LoadingGame.InNewScene; KickStarter.sceneChanger.ChangeScene ("", newScene, false); } else { loadingGame = LoadingGame.InSameScene; // Already in the scene Sound[] sounds = FindObjectsOfType (typeof (Sound)) as Sound[]; foreach (Sound sound in sounds) { if (sound.GetComponent <AudioSource>()) { if (sound.soundType != SoundType.Music && !sound.GetComponent <AudioSource>().loop) { sound.Stop (); } } } OnLevelWasLoaded (); } } }
private void OnLevelWasLoaded() { if (KickStarter.settingsManager.IsInLoadingScene ()) { return; } if (loadingGame == LoadingGame.InNewScene || loadingGame == LoadingGame.InSameScene) { if (KickStarter.dialog) { KickStarter.dialog.KillDialog (true, true); } if (KickStarter.playerInteraction) { KickStarter.playerInteraction.StopInteraction (); } 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.stateHandler.gameState = GameState.Cutscene; KickStarter.mainCamera.FadeIn (0.5f); Invoke ("ReturnToGameplay", 0.01f); } AssetLoader.UnloadAssets (); }
protected void OnAfterChangeScene(LoadingGame loadingGame) { isChangingScene = false; }
private void OnAfterChangeScene(LoadingGame loadingGame) { isChangingScene = false; }
private void ReturnToGameplay() { loadingGame = LoadingGame.No; KickStarter.playerInput.ReturnToGameplayAfterLoad (); if (KickStarter.sceneSettings) { KickStarter.sceneSettings.OnLoad (); } }
private void OnLevelWasLoaded () { SettingsManager settingsManager = AdvGame.GetReferences ().settingsManager; if (settingsManager.IsInLoadingScene ()) { return; } if (loadingGame == LoadingGame.InNewScene || loadingGame == LoadingGame.InSameScene) { if (GameObject.FindWithTag (Tags.gameEngine)) { if (GameObject.FindWithTag (Tags.gameEngine).GetComponent <Dialog>()) { Dialog dialog = GameObject.FindWithTag (Tags.gameEngine).GetComponent <Dialog>(); dialog.KillDialog (true); } if (GameObject.FindWithTag (Tags.gameEngine).GetComponent <PlayerInteraction>()) { PlayerInteraction playerInteraction = GameObject.FindWithTag (Tags.gameEngine).GetComponent <PlayerInteraction>(); playerInteraction.StopInteraction (); } } ReturnMainData (); levelStorage.ReturnCurrentLevelData (); if (loadingGame == LoadingGame.InSameScene) { loadingGame = LoadingGame.No; } } if (GetComponent <RuntimeInventory>()) { GetComponent <RuntimeInventory>().RemoveRecipes (); } if (loadingGame == LoadingGame.JustSwitchingPlayer) { foreach (PlayerData _data in saveData.playerData) { if (_data.playerID == KickStarter.player.ID) { ReturnCameraData (_data); break; } } GameObject.FindWithTag (Tags.persistentEngine).GetComponent <StateHandler>().gameState = GameState.Cutscene; KickStarter.mainCamera.FadeIn (0.5f); Invoke ("ReturnToGameplay", 0.01f); } AssetLoader.UnloadAssets (); }
protected virtual void OnLoadingGame(LoadEventArgs e) { LoadingGame?.Invoke(this, e); }