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; } } } }
// Update is called once per frame void Update() { if (isOn) { keyboard.interactable = true; keyboard.blocksRaycasts = true; FVAPI.lerpAlphaChannelTimeMultiplied(keyboard, 1, 2); //keyboard.alpha = Mathf.Lerp(keyboard.alpha, 1, Time.deltaTime*2); } else if (isOn && InputManager.GetKeyDown("pause")) { isOn = false; } else { keyboard.interactable = false; keyboard.blocksRaycasts = false; FVAPI.lerpAlphaChannelTimeMultiplied(keyboard, 0, 2); //keyboard.alpha = Mathf.Lerp(keyboard.alpha, 0, Time.deltaTime*2); } }
} //public void pressedUserName() /****************************************************************************************************************** * * Function: Update() * * Updates the alpha channels based on the booleans set above. * **/ void Update() { //Calls first, shows input field if (showInput) { inputGroup.interactable = true; FVAPI.lerpAlphaChannelTimeMultiplied(inputGroup, 1, 2); inputGroup.blocksRaycasts = true; } //After Enter is hit while in input field, this will call next else if (showNewName) { //Input field invisible inputGroup.interactable = false; FVAPI.lerpAlphaChannel(inputGroup, 0); inputGroup.blocksRaycasts = false; usernameGroup.interactable = true; FVAPI.lerpAlphaChannel(usernameGroup, 1); usernameGroup.blocksRaycasts = true; if (inputGroup.alpha <= 0.5f) { showNewName = false; saveLoadData.SaveUsers(); } } else { //Finishes making the inputGroup alpha invisible, not interactable and not able to block raycasts inputGroup.interactable = false; FVAPI.lerpAlphaChannelTimeMultiplied(inputGroup, 0, 2); inputGroup.blocksRaycasts = false; usernameGroup.interactable = true; FVAPI.lerpAlphaChannel(usernameGroup, 1); usernameGroup.blocksRaycasts = true; } }
void Update() { //If switchPan is true, move panel to the correct option if (switchPan) { elapsedTime += Time.deltaTime; GetComponent <RectTransform> ().position = Vector3.Lerp(GetComponent <RectTransform>().position, toVect, elapsedTime); if (GetComponent <RectTransform> ().position == toVect) { switchPan = false; } } else { elapsedTime = 0; } //TODO Finish the Options Menu //Shows correct menu based on which option is selected if (toVect == general.position) { FVAPI.lerpAlphaChannelTimeMultiplied(generalGroup, 1, 3); FVAPI.lerpAlphaChannelTimeMultiplied(soundGroup, 0, 3); FVAPI.lerpAlphaChannelTimeMultiplied(graphicsGroup, 0, 3); FVAPI.lerpAlphaChannelTimeMultiplied(advancedGroup, 0, 3); //soundGroup.alpha = Mathf.Lerp(soundGroup.alpha, 0, Time.deltaTime*3); //graphicsGroup.alpha = Mathf.Lerp(graphicsGroup.alpha, 1, Time.deltaTime*3); //controlsGroup.alpha = Mathf.Lerp(controlsGroup.alpha, 0, Time.deltaTime*3); generalGroup.interactable = true; soundGroup.interactable = false; graphicsGroup.interactable = false; advancedGroup.interactable = false; generalGroup.blocksRaycasts = true; soundGroup.blocksRaycasts = false; graphicsGroup.blocksRaycasts = false; advancedGroup.blocksRaycasts = false; } else if (toVect == sound.position) { FVAPI.lerpAlphaChannelTimeMultiplied(generalGroup, 0, 3); FVAPI.lerpAlphaChannelTimeMultiplied(soundGroup, 1, 3); FVAPI.lerpAlphaChannelTimeMultiplied(graphicsGroup, 0, 3); FVAPI.lerpAlphaChannelTimeMultiplied(advancedGroup, 0, 3); //soundGroup.alpha = Mathf.Lerp(soundGroup.alpha, 1, Time.deltaTime); //graphicsGroup.alpha = Mathf.Lerp(graphicsGroup.alpha, 0, Time.deltaTime*3); //controlsGroup.alpha = Mathf.Lerp(controlsGroup.alpha, 0, Time.deltaTime*3); generalGroup.interactable = false; soundGroup.interactable = true; graphicsGroup.interactable = false; advancedGroup.interactable = false; generalGroup.blocksRaycasts = false; soundGroup.blocksRaycasts = true; graphicsGroup.blocksRaycasts = false; advancedGroup.blocksRaycasts = false; } else if (toVect == graphics.position) { FVAPI.lerpAlphaChannelTimeMultiplied(generalGroup, 0, 3); FVAPI.lerpAlphaChannelTimeMultiplied(soundGroup, 0, 3); FVAPI.lerpAlphaChannelTimeMultiplied(graphicsGroup, 1, 3); FVAPI.lerpAlphaChannelTimeMultiplied(advancedGroup, 0, 3); //soundGroup.alpha = Mathf.Lerp(soundGroup.alpha, 0, Time.deltaTime*3); //graphicsGroup.alpha = Mathf.Lerp(graphicsGroup.alpha, 1, Time.deltaTime*3); //controlsGroup.alpha = Mathf.Lerp(controlsGroup.alpha, 0, Time.deltaTime*3); generalGroup.interactable = false; soundGroup.interactable = false; graphicsGroup.interactable = true; advancedGroup.interactable = false; generalGroup.blocksRaycasts = false; soundGroup.blocksRaycasts = false; graphicsGroup.blocksRaycasts = true; advancedGroup.blocksRaycasts = false; } else if (toVect == advanced.position) { FVAPI.lerpAlphaChannelTimeMultiplied(generalGroup, 0, 3); FVAPI.lerpAlphaChannelTimeMultiplied(soundGroup, 0, 3); FVAPI.lerpAlphaChannelTimeMultiplied(graphicsGroup, 0, 3); FVAPI.lerpAlphaChannelTimeMultiplied(advancedGroup, 1, 3); //soundGroup.alpha = Mathf.Lerp(soundGroup.alpha, 0, Time.deltaTime*3); //graphicsGroup.alpha = Mathf.Lerp(graphicsGroup.alpha, 0, Time.deltaTime*3); //controlsGroup.alpha = Mathf.Lerp(controlsGroup.alpha, 1, Time.deltaTime*3); generalGroup.interactable = false; soundGroup.interactable = false; graphicsGroup.interactable = false; advancedGroup.interactable = true; generalGroup.blocksRaycasts = false; soundGroup.blocksRaycasts = false; graphicsGroup.blocksRaycasts = false; advancedGroup.blocksRaycasts = true; } else { FVAPI.lerpAlphaChannelTimeMultiplied(generalGroup, 1, 3); FVAPI.lerpAlphaChannelTimeMultiplied(soundGroup, 0, 3); FVAPI.lerpAlphaChannelTimeMultiplied(graphicsGroup, 0, 3); FVAPI.lerpAlphaChannelTimeMultiplied(advancedGroup, 0, 3); //soundGroup.alpha = Mathf.Lerp(soundGroup.alpha, 0, Time.deltaTime*3); //graphicsGroup.alpha = Mathf.Lerp(graphicsGroup.alpha, 1, Time.deltaTime*3); //controlsGroup.alpha = Mathf.Lerp(controlsGroup.alpha, 0, Time.deltaTime*3); generalGroup.interactable = true; soundGroup.interactable = false; graphicsGroup.interactable = false; advancedGroup.interactable = false; generalGroup.blocksRaycasts = true; soundGroup.blocksRaycasts = false; graphicsGroup.blocksRaycasts = false; advancedGroup.blocksRaycasts = 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; } } } } }