protected virtual void UpdateCameraStates() { // CAMERA STATE - you can change the CameraState here, the bool means if you want lerp of not, make sure to use the same CameraState String that you named on TPCameraListData if (tpCamera == null) { tpCamera = FindObjectOfType <vThirdPersonCamera>(); if (tpCamera == null) { return; } if (tpCamera) { tpCamera.SetMainTarget(this.transform); tpCamera.Init(); } } if (changeCameraState && !cc.isStrafing) { tpCamera.ChangeState(customCameraState, customlookAtPoint, smoothCameraState); } else if (cc.isCrouching) { tpCamera.ChangeState("Crouch", true); } else if (cc.isStrafing) { tpCamera.ChangeState("Strafing", true); } else { tpCamera.ChangeState("Default", true); } }
/// <summary> /// Occurs when a scene is loaded completely, assigns the player to the level spawn point and reactivates components. /// </summary> /// <param name="scene">Current scene that has finished loading.</param> /// <param name="mode">Scene load method (Additive or Singular).</param> public void OnLevelFinishedLoading(Scene scene, LoadSceneMode mode) { // flag whether the lobby was just loaded (causes main menu to open auto) GameMainMenu.isNotLobby = (GameMainMenu.LobbySceneName != scene.name); GameMainMenu.SaveGameButton.SetActive(GameMainMenu.isNotLobby); GameMainMenu.LoadGameButton.SetActive(GameMainMenu.isNotLobby); GameMainMenu.ContinueButton.SetActive(!GameMainMenu.isNotLobby); // find the spawn point and update the player position GameObject psp = GameObject.Find("SpawnPoint"); if (psp) { GameObject player = GlobalFuncs.FindPlayerInstance(); //GameController.spawnPoint = psp.transform; player.transform.position = psp.transform.position; player.transform.rotation = psp.transform.rotation; } else { if (GameMainMenu.LobbySceneName != scene.name) { Debug.Log("Spawn Point NOT Found"); } } // start time and fade in from full screen texture #if !VANILLA PlayerCamera.Init(); #endif foreach (GameObject ui in GameMainMenu.UserInterface) { ui.SetActive(GameMainMenu.isNotLobby); } Time.timeScale = 1f; BeginFade(-1); Debug.Log("Load Level (" + scene.name + ") Complete"); // scene change sound if (GameMainMenu.SourceOfAudio && GameMainMenu.PlayOnSpawn) { // play audio? if (!GameMainMenu.SourceOfAudio.isPlaying) { // ignore if already playing GameMainMenu.SourceOfAudio.clip = (GameMainMenu.LobbySceneName != scene.name ? GameMainMenu.PlayOnSpawn : GameMainMenu.PlayOnDeath); // set the clip GameMainMenu.SourceOfAudio.Play(); // play the clip } } }
protected virtual void InitializeTpCamera() { if (tpCamera == null) { tpCamera = FindObjectOfType <vThirdPersonCamera>(); if (tpCamera == null) { return; } if (tpCamera) { tpCamera.SetMainTarget(this.transform); tpCamera.Init(); } } }
protected virtual void UpdateCameraStates() { // CAMERA STATE - you can change the CameraState here, the bool means if you want lerp of not, make sure to use the same CameraState String that you named on TPCameraListData if (tpCamera == null) { tpCamera = FindObjectOfType <vThirdPersonCamera>(); if (tpCamera == null) { return; } if (tpCamera) { tpCamera.SetMainTarget(this.transform); tpCamera.Init(); } } }