Пример #1
0
 public void Update()
 {
     //stay idle waiting for player to finish / cleanup to be done
     if (activated &&
         IndicatorReturnObject.NoInstancesExist() &&
         TetherManager.inst.EndLevelAllTetherPointsCollected())
     {
         //start transition
         sst = ScreenShaderTransition.getInstance("LevelChangeTransition");
         if (sst != null)
         {
             StartCoroutine(initDelay());
         }
         else
         {
             Debug.LogWarning("No Screen Shader Transition set up!");
         }
     }
 }
Пример #2
0
    void Update()
    {
        /*
         * Create tether point functionality
         */

        // Creating a tether point
        if (tetherUIState == TetherUIState.GAMEPLAY && !GameManager.isPlayerDead() && !GameManager.CameraIsZoomedOut() && GameManager.inst.pauseType == PauseType.NONE && !GameManager.isPlayerDashing() && !GameManager.GetPlayerScript().inPlaceTetherAnim())
        {
            if (PlayerControlManager.GetKeyDown(ControlInput.DROP_TETHER))
            {
                //CreatePoint();
                //GameManager.GetPlayer().GetComponent<Player>().setPlaceAnchorAnim();

                // Order flipped so the tether point exists for the screenshot
                // Test!
                CreatePoint();
            }
        }


        /*
         * Fast tethering functionality
         */

        // Keep track of the fast tether back key
        if (allowFastTether)
        {
            // These conditions determine whether tethering is allowed
            if (tetherUIState == TetherUIState.GAMEPLAY && !GameManager.isPlayerDead() && !GameManager.CameraIsZoomedOut() && !GameManager.isPlayerDashing() && !GameManager.isPaused())
            {
                // If the player presses the menu key, start the timer
                //if (Input.GetKeyDown(PlayerControlManager.LH_TetherMenu) || Input.GetKeyDown(PlayerControlManager.RH_TetherMenu))
                if (PlayerControlManager.GetKeyDown(ControlInput.TETHER_MENU))
                {
                    fastTetherKeyTimer = fastTetherKeyTime;
                }

                // If the menu button is released before the timer has reached zero, call a fast tether back
                //if (Input.GetKeyUp(PlayerControlManager.LH_TetherMenu) || Input.GetKeyUp(PlayerControlManager.RH_TetherMenu))
                if (PlayerControlManager.GetKeyUp(ControlInput.TETHER_MENU))
                {
                    OnFastTetherStart(LevelStateManager.curState);
                }
            }
        }
        else
        {
            fastTetherKeyTimer = 0;
        }

        // Update fastTetherKeyTimer
        if (fastTetherKeyTimer > 0)
        {
            fastTetherKeyTimer -= Time.deltaTime;
            if (fastTetherKeyTimer < 0)
            {
                fastTetherKeyTimer = 0;
            }
        }


        /*
         * Tether menu functionality
         */

        // Bringing up the tether menu
        // Adding the pause menu active check prevents the cursor from getting reverted to the gameplay cursor while the pause menu is up
        if ((tetherUIState == TetherUIState.GAMEPLAY || tetherUIState == TetherUIState.TETHER_MENU) && !PauseMenuManager.pauseMenuActive)
        {
            // Test for bringing up the menu, while alive
            if (!GameManager.isPlayerDead())
            {
                // If the tether menu key is held down
                //if (PlayerControlManager.GetKey(ControlInput.TETHER_MENU) && !GameManager.CameraIsZoomedOut() && fastTetherKeyTimer <= 0 && !GameManager.isPlayerDashing())
                if (PlayerControlManager.GetKey(ControlInput.TETHER_MENU) && fastTetherKeyTimer <= 0 && tetherMenuDisableTimer == 0 && !GameManager.isPlayerDashing() && (GameManager.inst.pauseType == PauseType.NONE || GameManager.inst.pauseType == PauseType.TETHER_MENU))
                {
                    tetherUIState = TetherUIState.TETHER_MENU;
                    //GameManager.setPause(true);
                    if (GameManager.inst.pauseType == PauseType.NONE)
                    {
                        GameManager.inst.EnterPauseState(PauseType.TETHER_MENU);
                    }

                    CursorManager.inst.lockCursorType = true;
                    CursorManager.inst.cursorState    = CursorState.MENU;
                    ShowTetherMenu();
                }
                else
                {
                    tetherUIState = TetherUIState.GAMEPLAY;

                    //GameManager.setPause(false);
                    if (GameManager.inst.pauseType == PauseType.TETHER_MENU)
                    {
                        GameManager.inst.ExitPauseState();
                        //Debug.Log("ExitPauseState()");
                    }

                    CursorManager.inst.lockCursorType = false;
                    CursorManager.inst.OnCursorBoundsUpdated();
                    HideTetherMenu();
                }
            }
            // If the player is dead, force the menu to come up
            else
            {
                tetherUIState = TetherUIState.TETHER_MENU;
                //GameManager.setPause(true);
                GameManager.inst.EnterPauseState(PauseType.TETHER_MENU);
                CursorManager.inst.lockCursorType = true;
                CursorManager.inst.cursorState    = CursorState.MENU;
                ShowTetherMenu();
            }
        }

        /*
         * Tether Corner HUD visibility
         */

        if (tetherHUDVisible)
        {
            tetherHUDGroup.alpha = Mathf.Lerp(tetherHUDGroup.alpha, 1, tetherHUDFadeInSpeed * Time.deltaTime);
        }
        else
        {
            tetherHUDGroup.alpha = Mathf.Lerp(tetherHUDGroup.alpha, 0, tetherHUDFadeOutSpeed * Time.deltaTime);
        }

        /*
         * Tether Corner HUD fading when zooming out
         */

        // When zooming/zoomed out, hide the bottom left time tether HUD
        // JK let's not do this

        /*
         * if (GameManager.CameraIsZoomedOut())
         * {
         * tetherHUDGroup.alpha = Mathf.Lerp(tetherHUDGroup.alpha, 0, tetherHUDFadeOutSpeed * Time.deltaTime);
         * }
         * // When zooming back in or not zoomed, reveal the bottom left time tether HUD
         * else
         * {
         * tetherHUDGroup.alpha = Mathf.Lerp(tetherHUDGroup.alpha, 1, tetherHUDFadeInSpeed * Time.deltaTime);
         * }
         */


        /*
         * Other Update Stuff
         */

        UpdateTimeArrowPos();
        //ScreenshotManager.inst.UpdateScreenshotState();

        if (tetherUIState == TetherUIState.TETHER_MENU)
        {
            if (menuLight != null && menuLightOn != null)
            {
                menuLight.sprite = menuLightOn;
            }
        }
        else
        {
            if (menuLight != null && menuLightOff != null)
            {
                menuLight.sprite = menuLightOff;
            }
        }


        // End level tether point collection
        // Once all indicator return objects have returned to the player and been destroyed, this will allow EndLevelAllTetherPointdCollected to return true
        if (endLevelWaitForCollection)
        {
            if (IndicatorReturnObject.NoInstancesExist())
            {
                endLevelWaitForCollection = false;
            }
        }

        if (tetherMenuDisableTimer > 0)
        {
            tetherMenuDisableTimer -= Time.deltaTime;
            if (tetherMenuDisableTimer < 0)
            {
                // Don't allow the timer to reach 0 until the tether menu key has been released
                if (PlayerControlManager.GetKey(ControlInput.TETHER_MENU))
                {
                    tetherMenuDisableTimer = 0.1f;
                }
                else
                {
                    tetherMenuDisableTimer = 0f;
                }
            }
        }
    }