IEnumerator DoLoadScene(string pSceneName, string SpawnPoint, PlayerCharacter.CharacterDirection pPlayerFacing) { string sceneNameAndSpawnPoint = pSceneName + "@" + SpawnPoint; FadeOut(0.5f); yield return(new WaitForSeconds(0.5f)); //SaveSystem.LoadScene(sceneNameAndSpawnPoint); SaveSystem.LoadScene(sceneNameAndSpawnPoint); yield return(null); //yield return SceneManager.LoadSceneAsync(pSceneName); if (GameObject.Find(SpawnPoint) != null) { Vector3 pos = GameObject.Find(SpawnPoint).transform.position; pos.z = ((pos.y / 100) - (pos.x / 1000)) - 5f; Player.transform.position = pos; } Player.ChangeFacing(pPlayerFacing); HUD.gameObject.SetActive(false); QuestHUD.GetComponent <PixelCrushers.QuestMachine.UnityUIQuestHUD>().Hide(); yield return(new WaitForSeconds(0.1f)); HUD.gameObject.SetActive(true); QuestHUD.GetComponent <PixelCrushers.QuestMachine.UnityUIQuestHUD>().Show(); // SaveSystem.ApplySavedGameData(); SceneChanged(); if (EventManager.Instance.Playing == false) { FadeIn(0.5f); yield return(new WaitForSeconds(0.5f)); UnPauseGame(); } }
public void StartCutscene(Vector3 pPlayerPos, PlayerCharacter.CharacterDirection pPlayerFacing, string pConversationName, List <EventNPCLocation> pLocations, UnityEvent pEvent) { PreviousPosition = Player.transform.position; PreviousFacing = Player.Direction; PauseGame(); StartCoroutine(DoCutsceneStart(pPlayerPos, pPlayerFacing, pConversationName, pLocations, pEvent)); }
public void RotateRight() { if (CurrentDirection == PlayerCharacter.CharacterDirection.Down) { CurrentDirection = PlayerCharacter.CharacterDirection.Right; } else if (CurrentDirection == PlayerCharacter.CharacterDirection.Right) { CurrentDirection = PlayerCharacter.CharacterDirection.Up; } else if (CurrentDirection == PlayerCharacter.CharacterDirection.Up) { CurrentDirection = PlayerCharacter.CharacterDirection.Left; } else if (CurrentDirection == PlayerCharacter.CharacterDirection.Left) { CurrentDirection = PlayerCharacter.CharacterDirection.Down; } SetAll(); }
IEnumerator DoCutsceneStart(Vector3 pPlayerPos, PlayerCharacter.CharacterDirection pPlayerFacing, string pConversationName, List <EventNPCLocation> pNPCs, UnityEvent pEvent) { // FadeOut(0.5f); yield return(new WaitForSeconds(0.5f)); Vector3 pos = pPlayerPos; pos.z = ((Player.transform.position.y / 100) - (Player.transform.position.x / 1000)) - 5f; Player.transform.position = pos; Player.ChangeFacing(pPlayerFacing); NPCManager.Instance.SpawnEventNPCs(pNPCs); pEvent.Invoke(); HUD.gameObject.SetActive(false); QuestHUD.GetComponent <PixelCrushers.QuestMachine.UnityUIQuestHUD>().Hide(); yield return(new WaitForSeconds(0.1f)); FadeIn(0.5f); yield return(new WaitForSeconds(0.5f)); DialogueManager.StartConversation(pConversationName); }
public void LoadScene(string pSceneName, string SpawnPoint, PlayerCharacter.CharacterDirection pPlayerFacing) { PauseGame(); StartCoroutine(DoLoadScene(pSceneName, SpawnPoint, pPlayerFacing)); }