コード例 #1
0
 void Update()
 {
     //If User enters the collider..
     if (triggerEntered)
     {
         elapsedTime += Time.deltaTime;
         //The "Hint" text becomes visible
         FVAPI.lerpAlphaChannel(hintTextGroup, 1, elapsedTime);
         //hintTextGroup.alpha = Mathf.Lerp(hintTextGroup.alpha,1,elapsedTime);
         //as well as the actual hint text
         FVAPI.lerpAlphaChannel(actualHintGroup, 1, elapsedTime);
         //actualHintGroup.alpha = Mathf.Lerp (0, 1, elapsedTime);
         //After three seconds
         if (elapsedTime > 3)
         {
             canvasTime += Time.deltaTime;
             //The text disappears
             FVAPI.lerpAlphaChannel(hintTextGroup, 0, canvasTime / 2);
             FVAPI.lerpAlphaChannel(actualHintGroup, 0, canvasTime / 2);
             //hintTextGroup.alpha = Mathf.Lerp (hintTextGroup.alpha, 0, canvasTime/2);
             //actualHintGroup.alpha = Mathf.Lerp (1, 0, canvasTime / 2);
             //Once invisible, the triggerEntered bool becomes false
             if (hintTextGroup.alpha <= 0)
             {
                 triggerEntered = false;
             }
         }
     }
 }
コード例 #2
0
 void Update()
 {
     //Made true in ResumeEnter()
     if (hovering)
     {
         elapsedTime += .05f;
         //Lerps the alpha channel to invisible
         FVAPI.lerpAlphaChannel(resumeGroup, 0, elapsedTime);
         //resumeGroup.alpha = Mathf.Lerp(resumeGroup.alpha, 0, elapsedTime);
         //Made true in PauseMenu class under the clickedJournal() method
         if (pauseMenu.journalKey)
         {
             //Lerps the Pages to invisible
             FVAPI.lerpAlphaChannel(pageNotes, 0, elapsedTime);
         }
         //pageNotes.alpha = Mathf.Lerp(pageNotes.alpha, 0, elapsedTime);
     }
     //Made false in ResumeExit()
     else if (!hovering)
     {
         elapsedTime += .05f;
         //Lerps the menu back to visible
         FVAPI.lerpAlphaChannel(resumeGroup, 1, elapsedTime);
         //resumeGroup.alpha = Mathf.Lerp(resumeGroup.alpha, 1, elapsedTime);
     }
 }
コード例 #3
0
 // Update is called once per frame
 void Update()
 {
     if (FVAPI.playerClicked(100, camObject, "CircuitBoard"))
     {
         circuitBoard.SetActive(true);
     }
 }
コード例 #4
0
    void LeanRight()
    {
        //Debug.Log("LeanRight");
        FVAPI.lerpVectorAndQuaternionTimeMultiplied(cam, leanRight, 5);
        //mouseLookX.enabled = false;
        //mouseLookY.enabled = false;
//		mouseLookInitCam.enabled = false;
    }
コード例 #5
0
    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;
                }
            }
        }
    }
コード例 #6
0
    void LeanBack()
    {
//		Debug.Log("LeanBack");
        FVAPI.lerpVectorAndQuaternionTimeMultiplied(cam, initCam, 4);
        if (cam.rotation.z <= 0.01f && cam.rotation.z >= -0.01f)
        {
            allowedToLean = true;
//			mouseLookX.enabled = true;
//			mouseLookY.enabled = true;
//			mouseLookInitCam.enabled = true;
        }
    }
コード例 #7
0
 void Update()
 {
     //If the mouse is over the Pencil, the add Player text will appear
     if (hovering)
     {
         FVAPI.lerpAlphaChannel(addPlayer, 1);
     }
     //addPlayer.alpha = Mathf.Lerp(addPlayer.alpha, 1, Time.deltaTime);
     //Else the text will disappear
     else
     {
         FVAPI.lerpAlphaChannel(addPlayer, 0);
     }
     //addPlayer.alpha = Mathf.Lerp(addPlayer.alpha, 0, Time.deltaTime*2);
 }
コード例 #8
0
    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;
        }
    }
コード例 #9
0
    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit, 100))
            {
                if (hit.collider.tag == "matchBox")
                {
                    matchBoxGO = hit.collider.gameObject;
                    matchBoxGO.GetComponent <MeshRenderer>().enabled = false;
                    matchBoxGO.GetComponent <Collider>().enabled     = false;
                    match      += 10;
                    timeLeft    = 30;
                    isActivated = true;
                    if (!hasRan)
                    {
                        matchBoxGO.transform.rotation = FVAPI.createQuaternionAdditive(matchBoxGO, 90, 0, 0, 0);

                        rendTexture.CreateRendTexture(matchBoxGO);
                        hasRan = true;
                    }
                }
            }
        }

        if (isActivated)
        {
            //matchTextAlpha.alpha = Mathf.Lerp (matchTextAlpha.alpha, 1, Time.deltaTime);
            FVAPI.lerpAlphaChannel(matchTextAlpha, 1);
            if (matchTextAlpha.alpha >= 1)
            {
                //matchTextAlpha.alpha = Mathf.Lerp(matchTextAlpha.alpha, 0, Time.deltaTime);
                FVAPI.lerpAlphaChannel(matchTextAlpha, 0);
                if (matchTextAlpha.alpha <= 0)
                {
                    isActivated = false;
                }
            }
        }
    }
コード例 #10
0
 // 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);
     }
 }
コード例 #11
0
    }     //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;
        }
    }
コード例 #12
0
 // Update is called once per frame
 void Update()
 {
     if (prelevel)
     {
         FVAPI.lerpAlphaChannel(blackFader, 0);
         //blackFader.alpha = Mathf.Lerp(blackFader.alpha, 0, Time.deltaTime);
         if (blackFader.alpha <= 0.15f)
         {
             blackFader.alpha = 0;
             prelevel         = false;
         }
     }
     else if (postlevel)
     {
         FVAPI.lerpAlphaChannel(blackFader, 1, 0.25f);
         //blackFader.alpha = Mathf.Lerp(blackFader, 1, Time.deltaTime);
         if (blackFader.alpha >= 0.9999999f)
         {
             postlevel = false;
             Application.LoadLevel(2);                  // Make this more variable soon
         }
     }
 }
コード例 #13
0
 void Update()
 {
     //isActivated by OnMouseDown()
     if (isActivated)
     {
         elapsedTime += Time.deltaTime;
         //Displays the "Added note to Journal"
         FVAPI.lerpAlphaChannel(pageAlpha, 1, elapsedTime);
         //pageAlpha.alpha = Mathf.Lerp (pageAlpha.alpha, 1, elapsedTime);
         if (elapsedTime >= 10)
         {
             canvasTime += Time.deltaTime;
             //Slowly lerps to invisible
             FVAPI.lerpAlphaChannel(pageAlpha, 0, canvasTime);
             //pageAlpha.alpha = Mathf.Lerp(pageAlpha.alpha, 0, canvasTime);
             if (pageAlpha.alpha <= 0)
             {
                 //Breaks loop and sets the object to false to save on resources
                 isActivated = false;
                 gameObject.SetActive(false);
             }
         }
     }
 }
コード例 #14
0
    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;
                    }
                }
            }
        }
    }
コード例 #15
0
    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;
        }
    }
コード例 #16
0
    void Update()
    {
        //If the journalTime is over 1, reset it to 1
        if (journalTime > 1)
        {
            journalTime = 1;
        }

        if (hovering)
        {
            elapsedTime += .1f;
            //Lerps the journalCover to visible
            FVAPI.lerpAlphaChannel(journalCover, 1, elapsedTime);
            //journalCover.alpha = Mathf.Lerp (journalCover.alpha, 1, elapsedTime);
        }
        else if (!hovering)
        {
            if (journalCover.alpha <= 0)
            {
                elapsedTime = 0;
            }
            else
            {
                elapsedTime += .1f;
                //Lerps the journalCover to invisible
                FVAPI.lerpAlphaChannel(journalCover, 0, elapsedTime);
                //journalCover.alpha = Mathf.Lerp (journalCover.alpha, 0, elapsedTime);
            }
        }

        //If the journalKey is true, set by clickedJournal() method in PauseMenu class
        if (pauseMenu.journalKey)
        {
            //Set hovering to false so that the cover will disappear
            hovering = false;
            //This seems redundant...
            journalTime += .05f;
            FVAPI.lerpAlphaChannel(journalCover, 0, journalTime);
            //journalCover.alpha = Mathf.Lerp(journalCover.alpha, 0, journalTime);

            //if the hovering variable from ResumeButton class is true, lerp the pages to invisible
            if (resumeButton.hovering)
            {
                FVAPI.lerpAlphaChannel(pagesBackground, 0, resumeButton.elapsedTime);
            }
            //pagesBackground.alpha = Mathf.Lerp(pagesBackground.alpha, 0, resumeButton.elapsedTime);
            //Else lerp the pages to visible
            else
            {
                FVAPI.lerpAlphaChannel(pagesBackground, 1, journalTime);
            }
            //pagesBackground.alpha = Mathf.Lerp(pagesBackground.alpha, 1, journalTime);
        }
        //If the journalKey is false, and the pages is not invisible
        else if (!pauseMenu.journalKey && pagesBackground.alpha > 0)
        {
            FVAPI.lerpAlphaChannel(pagesBackground, 0, journalTime);
            //pagesBackground.alpha = Mathf.Lerp(pagesBackground.alpha, 0, journalTime);
            journalTime += .1f;
        }
    }
コード例 #17
0
    //float elapsedTime = 0;
    //float canvasTime = 0;

    // Update is called once per frame
    void LateUpdate()
    {
        //TODO

        if (InputManager.GetKeyDown("inventory") || InputManager.GetKeyDown("inventorySecondary"))
        {
            RPressed = !RPressed;
            //elapsedTime = 0;
            //canvasTime = 0;
        }

        if (RPressed)
        {
            if (firstPass)
            {
                initialRotation = mainCamera.transform.rotation;
                firstPass       = false;
            }

            Cursor.lockState = CursorLockMode.None;
            Cursor.visible   = true;

            FVAPI.lerpVector3TimeMultiplied(rucksack.transform, rucksack_END.transform, 2);
            mainCamera.transform.LookAt(rucksack_END.transform);
            //elapsedTime += Time.deltaTime;
            //inventoryBack.alpha = Mathf.Lerp (inventoryBack.alpha, 1, elapsedTime);
            //inventoryBack.blocksRaycasts = true;
            //Time.timeScale = Mathf.Lerp(Time.timeScale, 0f, elapsedTime*2);
            //if(Time.timeScale <= 0.4)
            //{

            //canvasTime += Time.deltaTime;
            //inventorySlots.alpha = Mathf.Lerp(inventorySlots.alpha, 1, canvasTime);
            //inventorySlots.interactable = true;
            //inventorySlots.blocksRaycasts = true;
            //xLook.GetComponent<MouseLook>().enabled = false;
            //yLook.GetComponent<MouseLook>().enabled = false;

            //}
        }
        else if (!RPressed && !pauseMenu.escKey)
        {
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;

            FVAPI.lerpVector3TimeMultiplied(rucksack.transform, rucksack_INIT.transform, 2);
            firstPass = true;
            FVAPI.lerpQuaternionTimeMultiplied(mainCamera.transform.rotation, initialRotation, 2);

            //xLook.GetComponent<MouseLook>().enabled = true;
            //yLook.GetComponent<MouseLook>().enabled = true;
            //canvasTime += Time.deltaTime;
            //inventorySlots.alpha = Mathf.Lerp(inventorySlots.alpha, 0, canvasTime);
            //inventorySlots.interactable = false;
            //inventorySlots.blocksRaycasts = false;

            /*if(inventorySlots.alpha <= 0)
             * {
             *
             *      elapsedTime += Time.deltaTime;
             *      inventoryBack.alpha = Mathf.Lerp (inventoryBack.alpha, 0, elapsedTime);
             *      inventoryBack.blocksRaycasts = false;
             *      Time.timeScale = Mathf.Lerp(Time.timeScale, 1f, elapsedTime);
             *
             * }*/
        }
    }
コード例 #18
0
    void Update()
    {
        //Just to keep the times in reasonable limits
        if (elapsedTime > 1)
        {
            elapsedTime = 1;
        }
        if (canvasTime > 1)
        {
            canvasTime = 1;
        }
        //TODO Still fix the "Hover over resume"

        //If the esc button is pressed..
        if (InputManager.GetKeyDown("pause") || InputManager.GetKeyDown("pauseSecondary"))
        {
            //.. set to false if true, true if false
            if (!inventory.RPressed)
            {
                escKey = !escKey;
            }
            //else
            //	inventory.RPressed = false;
            elapsedTime = 0;
            canvasTime  = 0;
        }
        //If the notes button is pressed..
        if (InputManager.GetKeyDown("notes"))
        {
            //.. Calls the method clickedJournal() which is below
            clickedJournal();
            elapsedTime = 0;
            canvasTime  = 0;
        }

        //if the escKey is true..
        if (escKey)
        {
            elapsedTime += .05f;
            //Allow the cursor to roam free and set it to be visible
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible   = true;
            //No raycasts can get through
            backgroundPauseGroup.blocksRaycasts = true;
            //Pauses the game
            Time.timeScale = 0;
            //if the alpha is below one
            if (backgroundPauseGroup.alpha < 1)
            {
                //Lerps the alpha to visible of the side bar and the background
                FVAPI.lerpAlphaChannel(sidePanelGroup, 1, elapsedTime);
                FVAPI.lerpAlphaChannel(backgroundPauseGroup, 1, elapsedTime);
                //sidePanelGroup.alpha = Mathf.Lerp(sidePanelGroup.alpha, 1, elapsedTime);
                //backgroundPauseGroup.alpha = Mathf.Lerp (backgroundPauseGroup.alpha, 1, elapsedTime);
                //Also set it so no raycasts can go through
                sidePanelGroup.blocksRaycasts       = true;
                backgroundPauseGroup.blocksRaycasts = true;
            }
            //else if it is equal to or above 1
            else if (backgroundPauseGroup.alpha >= 1)
            {
                canvasTime += .05f;
                //Lerp the alpha to visible of the buttons
                FVAPI.lerpAlphaChannel(buttonGroup, 1, canvasTime);
                //buttonGroup.alpha = Mathf.Lerp(buttonGroup.alpha, 1, canvasTime);
                buttonGroup.interactable = true;
            }
        }
        //Else if the esc key is false
        else if (!escKey)        //&& !inventory.RPressed)
        {
            if (buttonGroup.alpha > 0)
            {
                canvasTime += .05f;
                //Lerp alpha to invisible of the buttons
                FVAPI.lerpAlphaChannel(buttonGroup, 0, canvasTime);
                //buttonGroup.alpha = Mathf.Lerp(buttonGroup.alpha, 0, canvasTime);
                buttonGroup.interactable = false;
            }
            else if (backgroundPauseGroup.alpha >= 0)
            {
                elapsedTime += .05f;
                //Set journalKey to false since it will be fading out
                journalKey = false;
                //Lerp the alpha to invisible of the side panel and background
                FVAPI.lerpAlphaChannel(sidePanelGroup, 0, elapsedTime);
                FVAPI.lerpAlphaChannel(backgroundPauseGroup, 0, elapsedTime);
                //sidePanelGroup.alpha = Mathf.Lerp(sidePanelGroup.alpha, 0, elapsedTime);
                //backgroundPauseGroup.alpha = Mathf.Lerp (backgroundPauseGroup.alpha, 0, elapsedTime);
                //Does not block raycasts
                sidePanelGroup.blocksRaycasts       = false;
                backgroundPauseGroup.blocksRaycasts = false;
                //Set cursor to locked and invisible
                //Debug.Log("Invisible");
                Cursor.lockState = CursorLockMode.Locked;
                Cursor.visible   = false;
                if (sidePanelGroup.alpha <= 0)
                {
                    //Resume gameplay
                    Time.timeScale = 1;
                }
            }
        }
    }