void Update() { //This is made true in OnMouseDown() if (pointerDown) { elapsedTime += Time.deltaTime; //Lerps for position and rotation towards the book FVAPI.lerpVectorAndQuaternion(mainCam, finalCam, elapsedTime / 10); //camPos.position = Vector3.Lerp(camPos.position, finalCamPos.position, elapsedTime/10); //camRot.rotation = Quaternion.Lerp(camRot.rotation, finalCamRot.rotation, elapsedTime/10); //if the Camera position equals the position to go to.. if (mainCam.position.z >= finalCam.position.z - 0.05f) { //..The alpha channels of the Users Canvas Group and Back button become visible and interactable FVAPI.lerpAlphaChannel(login, 1); //login.alpha = Mathf.Lerp(login, 1, Time.deltaTime); login.interactable = true; } } //else if the pointer is false, the initial Camera's position exists, and the moveTo boolean of the //class MoveToMainMenu is false.. //pointerDown made false in returnCamera() else if (!pointerDown && initCam != null && !moveToMain.moveTo) { elapsedTime += Time.deltaTime; //Lerps for position and rotation towards the inital Camera position if (goingToMenu) { //Lerps for position and rotation towards the inital Camera position FVAPI.lerpVectorAndQuaternion(mainCam, initCam, elapsedTime / 10); //camPos.position = Vector3.Lerp(camPos.position, initCamPos.position, elapsedTime/10); //camRot.rotation = Quaternion.Lerp(camRot.rotation, initCamRot.rotation, elapsedTime/10); //The alpha channels of the Users Canvas Group and Back button become invisible and not interactable FVAPI.lerpAlphaChannelTimeMultiplied(login, 0, 2); //login.alpha = Mathf.Lerp(login.alpha, 0, Time.deltaTime*2); login.interactable = false; } //readToMove bool made true when called in moveToMainMenu() if (mainCam.position == initCam.position && readyToMove) { //moveTo bool becomes true in the MoveToMainMenu class if (goingToMenu) { moveToMain.moveTo = true; moveToMain.doNotMove = true; } else { moveToMain.elapsedTime = 0; moveToMain.timeToMoveToMain = 0; moveToMain.moveBack = false; } } } }
void Update() { if (moveTo) { elapsedTime += Time.deltaTime; //Lerps the position and rotation to options menu FVAPI.lerpVectorAndQuaternion(mainCam, finalCam, elapsedTime / 2); //camPos.position = Vector3.Lerp (camPos.position, finalCamPos.position, elapsedTime/2); //camPos.rotation = Quaternion.Slerp (camRot.rotation, finalCamRot.rotation, elapsedTime/2); //If current Camera position is equal to the target.. if (mainCam.position == finalCam.position) { //.. Options menu's alpha becomes visible and interactable canvasTime += Time.deltaTime; optionsMenu.interactable = true; FVAPI.lerpAlphaChannel(optionsMenu, 1, canvasTime); //optionsMenu.alpha = Mathf.Lerp (optionsMenu.alpha, 1, canvasTime); //backOption.alpha = Mathf.Lerp (backOption.alpha, 1, canvasTime); //scrollOver.alpha = Mathf.Lerp (scrollOver.alpha, 1, canvasTime); } } //else if current Camera position is equal to inital position else if (moveBackToMenu) { elapsedTime += Time.deltaTime; //Lerps the position and rotation to inital position FVAPI.lerpVectorAndQuaternion(mainCam, initCam, elapsedTime / 2); //mainCam.position = Vector3.Lerp (mainCam.position, initCam.position, elapsedTime/2); //mainCam.rotation = Quaternion.Slerp (mainCam.rotation, initCam.rotation, elapsedTime/2); //Alpha invisible and interactable FVAPI.lerpAlphaChannel(optionsMenu, 0, elapsedTime * 2); FVAPI.lerpAlphaChannel(graphics, 0); FVAPI.lerpAlphaChannel(sound, 0); FVAPI.lerpAlphaChannel(controls, 0); //optionsMenu.alpha = Mathf.Lerp (optionsMenu.alpha, 0, elapsedTime*2); //backOption.alpha = Mathf.Lerp (backOption.alpha, 0, elapsedTime*2); //scrollOver.alpha = Mathf.Lerp (scrollOver.alpha, 0, elapsedTime*2); //graphics.alpha = Mathf.Lerp(graphics.alpha, 0, Time.deltaTime); //sound.alpha = Mathf.Lerp(sound.alpha, 0, Time.deltaTime); //controls.alpha = Mathf.Lerp(controls.alpha, 0, Time.deltaTime); optionsMenu.interactable = false; } }
void Update() { //moveTo is called in the Update of NewPlayerClick if (moveTo) { moveBack = false; if (doNotMove) { //runs if atMain is true if (atMain) { timeToMoveToMain += Time.deltaTime; //Lerps for position and rotation towards the actual Menu FVAPI.lerpVectorAndQuaternion(mainCam, finalCam, timeToMoveToMain / 7); //camPos.position = Vector3.Lerp(camPos.position, finalCamPos.position, timeToMoveToMain/7); //camRot.rotation = Quaternion.Lerp(camRot.rotation, finalCamRot.rotation, timeToMoveToMain/7); if (mainCam.position == finalCam.position) { timeToMoveToMain = 0; doNotMove = false; } } //runs if atMain is false else { elapsedTime += Time.deltaTime; //Lerps for position and rotation towards the transition point FVAPI.lerpVectorAndQuaternion(mainCam, transCam, elapsedTime / 7); //camPos.position = Vector3.Lerp(camPos.position, transCamPos.position, elapsedTime/7); //camRot.rotation = Quaternion.Lerp(camRot.rotation, transCamRot.rotation, elapsedTime/7); //When the Camera position eqauls the transition point.. if (mainCam.position.z > transCam.position.z - 0.075f) { //..atMain becomes true elapsedTime = 0; atMain = true; } } } else { FVAPI.lerpAlphaChannelTimeMultiplied(mainMenuText, 1, 2); //mainMenuText.alpha = Mathf.Lerp(mainMenuText.alpha, 1, Time.deltaTime*2); mainMenuText.blocksRaycasts = true; mainMenuText.interactable = true; } } //moveBack is called in mainMenu else if (moveBack) { if (atMain) { moveOptions.moveBackToMenu = false; moveOptions.moveTo = false; doorOpen.Play("MainMenuDoorOpen"); timeToMoveToMain += Time.deltaTime; FVAPI.lerpAlphaChannelTimeMultiplied(mainMenuText, 0, 2); //mainMenuText.alpha = Mathf.Lerp(mainMenuText.alpha, 0, Time.deltaTime*2); mainMenuText.blocksRaycasts = false; mainMenuText.interactable = false; FVAPI.lerpVectorAndQuaternion(mainCam, transCam, timeToMoveToMain / 10); //mainCam.position = Vector3.Lerp(camPos.position, transCamPos.position, timeToMoveToMain/10); //mainCam.rotation = Quaternion.Lerp(camRot.rotation, transCamRot.rotation, timeToMoveToMain/10); if (mainCam.position.z < transCam.position.z + 0.075f) { timeToMoveToMain = 0; atMain = false; } } else { elapsedTime += Time.deltaTime; //mainCam.position = Vector3.Lerp(transCam.position, initialCam.position, elapsedTime); //mainCam.rotation = Quaternion.Lerp(transCam.rotation, initialCam.rotation, elapsedTime); FVAPI.lerpVectorAndQuaternion(mainCam, loginCam, elapsedTime / 10); if (mainCam.position == loginCam.position) { elapsedTime = 0; canvasTime += Time.deltaTime; FVAPI.lerpAlphaChannel(login, 1, canvasTime); if (login.alpha == 1) { canvasTime = 0; moveBack = false; login.interactable = true; } } } } }