void Update()
    {
        if (IsGameOver)
        {
            return;
        }

        if (TD_SBF_PlayerStatistics.Lives <= 0)
        {
            EndGame();
        }

        if (Input.GetKeyDown(KeyCode.B) ||
            contSupp.ControllerBumperLeft("down"))
        {
            cMan.ToggleHeroBar();
            cMan.DisableHeroBar();
            cMan.ToggleBuildBar();
            DisableHeroMode();
            ToggleTowerMode();
        }

        if (Input.GetKeyDown(KeyCode.H) ||
            contSupp.ControllerBumperRight("down"))
        {
            cMan.ToggleBuildBar();
            cMan.DisableBuildBar();
            cMan.ToggleHeroBar();
            DisableTowerMode();
            ToggleHeroMode();
        }
    }
示例#2
0
    private void HandleInputs()
    {
        if (Input.GetKey(KeyCode.Equals) ||
            (contSupp.ControllerTriggerRight() > 0))
        {
            scale *= .99f;
        }
        else if (Input.GetKey(KeyCode.Minus) ||
                 (contSupp.ControllerTriggerLeft() > 0))
        {
            scale *= 1.01f;
        }

        if (Input.GetKey(KeyCode.E) ||
            contSupp.ControllerBumperLeft("hold"))
        {
            angle -= 0.01f;
        }
        else if (Input.GetKey(KeyCode.Q) ||
                 contSupp.ControllerBumperRight("hold"))
        {
            angle += 0.01f;
        }

        Vector2 dir = new Vector2(0.01f * scale, 0);
        float   s   = Mathf.Sin(angle);
        float   c   = Mathf.Cos(angle);

        dir = new Vector2(dir.x * c, dir.x * s);

        if (Input.GetKey(KeyCode.A) ||
            contSupp.ControllerLeftJoystickHorizontal() < 0 ||
            contSupp.ControllerDirectionalPadHorizontal() < 0)
        {
            pos -= dir;
        }
        else if (Input.GetKey(KeyCode.D) ||
                 contSupp.ControllerLeftJoystickHorizontal() > 0 ||
                 contSupp.ControllerDirectionalPadHorizontal() > 0)
        {
            pos += dir;
        }

        dir = new Vector2(-dir.y, dir.x);

        if (Input.GetKey(KeyCode.S) ||
            contSupp.ControllerLeftJoystickVertical() < 0 ||
            contSupp.ControllerDirectionalPadVertical() < 0)
        {
            pos -= dir;
        }
        else if (Input.GetKey(KeyCode.W) ||
                 contSupp.ControllerLeftJoystickVertical() > 0 ||
                 contSupp.ControllerDirectionalPadVertical() > 0)
        {
            pos += dir;
        }
    }
    void Update()
    {
        // Restore on certain scenes / conditions
        if (bRestoreOverTime &&
            (!pause.bPauseActive &&
             !dMan.bDialogueActive &&
             !sceneTrans.isActiveAndEnabled))
        {
            BasicRestorePlayer();
        }

        // Temp solution to give Brio
        if (Input.GetKeyUp(KeyCode.X) ||
            (contSupp.ControllerBumperLeft("down") &&
             contSupp.ControllerBumperRight("down")))
        {
            RestorePlayer(50);
            uMan.UpdateBrio();
        }
    }
示例#4
0
    private void HandleInputs()
    {
        // Zoom Out
        if (Input.GetKey(KeyCode.I) ||
            contSupp.ControllerTriggerRight() > 0 ||
            tConts.bYaction)
        {
            if (scale > 0.00000001f)
            {
                scale *= .99f;
            }
            // Jump to max zoomed-out level
            else
            {
                scale = 75000f;
            }
        }
        // Zoom In
        else if (Input.GetKey(KeyCode.K) ||
                 contSupp.ControllerTriggerLeft() > 0 ||
                 tConts.bXaction)
        {
            if (scale < 75000f)
            {
                scale *= 1.01f;
            }
            // Jump to max zoomed-in level
            else
            {
                scale       = 0.00000001f;
                smoothScale = Mathf.Lerp(scale, scale, 0.0333f);
                pos.x       = -0.7500075f;
                pos.y       = 0.003150068f;
                mat.SetVector("_Area", new Vector4(pos.x, pos.y, scale, scale));
            }
        }

        // Rotate Left
        if (Input.GetKey(KeyCode.J) ||
            contSupp.ControllerBumperLeft("hold") ||
            tConts.bAaction)
        {
            angle -= 0.01f;
        }
        // Rotate Right
        else if (Input.GetKey(KeyCode.L) ||
                 contSupp.ControllerBumperRight("hold") ||
                 tConts.bBaction)
        {
            angle += 0.01f;
        }

        Vector2 dir = new Vector2(0.01f * scale, 0);
        float   s   = Mathf.Sin(angle);
        float   c   = Mathf.Cos(angle);

        dir = new Vector2(dir.x * c, dir.x * s);

        // Move Left
        if (Input.GetKey(KeyCode.A) ||
            contSupp.ControllerLeftJoystickHorizontal() < 0 ||
            contSupp.ControllerDirectionalPadHorizontal() < 0 ||
            tConts.bLeft)
        {
            pos -= dir;
        }
        // Move Right
        else if (Input.GetKey(KeyCode.D) ||
                 contSupp.ControllerLeftJoystickHorizontal() > 0 ||
                 contSupp.ControllerDirectionalPadHorizontal() > 0 ||
                 tConts.bRight)
        {
            pos += dir;
        }

        dir = new Vector2(-dir.y, dir.x);

        // Move Down
        if (Input.GetKey(KeyCode.S) ||
            contSupp.ControllerLeftJoystickVertical() < 0 ||
            contSupp.ControllerDirectionalPadVertical() < 0 ||
            tConts.bDown)
        {
            pos -= dir;
        }
        // Move Up
        else if (Input.GetKey(KeyCode.W) ||
                 contSupp.ControllerLeftJoystickVertical() > 0 ||
                 contSupp.ControllerDirectionalPadVertical() > 0 ||
                 tConts.bUp)
        {
            pos += dir;
        }

        // Cycle Colors
        if (Input.GetKey(KeyCode.U) ||
            contSupp.ControllerButtonPadTop("hold") ||
            tConts.bUpLeft)
        {
            if (color > 0)
            {
                color -= 0.01f;
            }
        }
        else if (Input.GetKey(KeyCode.O) ||
                 contSupp.ControllerButtonPadLeft("hold") ||
                 tConts.bUpRight)
        {
            if (color < 1)
            {
                color += 0.01f;
            }
        }

        // Kaleidoscope
        if (Input.GetKey(KeyCode.E) ||
            contSupp.ControllerButtonPadRight("hold") ||
            tConts.bDownLeft)
        {
            if (symmetry > 0)
            {
                symmetry -= 0.1f;
            }

            else if (symmetry < 0)
            {
                symmetry = 0;
            }
        }
        else if (Input.GetKey(KeyCode.Q) ||
                 contSupp.ControllerButtonPadBottom("hold") ||
                 tConts.bDownRight)
        {
            if (symmetry < 1)
            {
                symmetry += 0.1f;
            }
        }

        if (Input.GetKey(KeyCode.R) ||
            contSupp.ControllerMenuLeft("hold") ||
            Input.touchCount == 3)
        {
            ResetShader();
        }
    }
    void Update()
    {
        if (contSupp.bControllerConnected &&
            upgradeShell.activeSelf &&
            !bIsNowNodeUIMode &&
            !buildDescBarSel.bIsNowBuildDescMode)
        {
            upgradeB.Select();
            bIsNowNodeUIMode = true;
            currentSelection = NodeUISelection.Upgrade;

            cMan.OnTUB();
            cMan.RestoreTUBInteractability();

            contSupp.bBelayAction = true;
        }

        if (contSupp.bControllerConnected &&
            bIsNowNodeUIMode &&
            upgradeShell.activeSelf)
        {
            // Controller Support
            if (contSupp.ControllerRightJoystickVertical() == 0)
            {
                bFreezeControllerInput = false;
            }
            else if (!bFreezeControllerInput &&
                     contSupp.ControllerRightJoystickVertical() > 0)
            {
                bControllerDown        = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     contSupp.ControllerRightJoystickVertical() < 0)
            {
                bControllerUp          = true;
                bFreezeControllerInput = true;
            }

            if (bControllerDown)
            {
                bControllerDown = false;
                MoveDown();
            }
            else if (bControllerUp)
            {
                bControllerUp = false;
                MoveUp();
            }
            else if (contSupp.ControllerButtonPadBottom("down"))
            {
                SelectOption();
            }
            else if (contSupp.ControllerButtonPadRight("down"))
            {
                StartCoroutine(contSupp.BelayAction());

                ResetNodeUI();
                shopSel.ResetTowerMode();
            }
            else if (contSupp.ControllerBumperRight("down") ||
                     contSupp.ControllerBumperLeft("down"))
            {
                shopSel.ResetScroll();
            }
        }
    }