void Update()
    {
        if ((contSupp.ControllerButtonPadTop("down") ||
             contSupp.ControllerButtonPadLeft("down")) &&
            gMan.bIsHeroMode &&
            !EventSystem.current.IsPointerOverGameObject())
        {
            heroBarMan.ToggleHeroUpgradeShells();
        }

        if (Input.GetKeyDown(KeyCode.Alpha1) &&
            Input.GetKeyDown(KeyCode.Alpha0))
        {
            TD_SBF_PlayerStatistics.ThoughtsPrayers += 1000;
        }

        if (heroStats.bIsDead)
        {
            return;
        }

        if (basicAttackWaitCounter <= 0)
        {
            if ((Input.GetMouseButtonDown(0) ||
                 contSupp.ControllerButtonPadBottom("down")) &&
                gMan.bIsHeroMode &&
                !EventSystem.current.IsPointerOverGameObject() &&
                !heroBarMan.bUpgrading &
                !tConts.bAvoidSubUIElements)
            {
                BasicAttack();
            }
        }
        else
        {
            basicAttackWaitCounter -= Time.deltaTime;
        }

        if (secondaryAttackWaitCounter <= 0)
        {
            if ((Input.GetMouseButtonDown(1) ||
                 contSupp.ControllerButtonPadRight("down")) &&
                gMan.bIsHeroMode &&
                !EventSystem.current.IsPointerOverGameObject() &&
                !heroBarMan.bUpgrading)
            {
                StartSecondaryAttack();
            }
        }
        else
        {
            secondaryAttackWaitCounter -= Time.deltaTime;
        }
    }
Exemplo n.º 2
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();
        }
    }
Exemplo n.º 3
0
    void Update()
    {
        // New Game -- Dialogue activation & strobe arrow start
        if (strobeTimer > 0)
        {
            // Script Pref -- Run uMan once after initial load in UIManager
            if (strobeTimer == 1f)
            {
                uMan.HideBrioAndButton();
            }

            strobeTimer -= Time.deltaTime;

            if (strobeTimer <= 0)
            {
                bOptModeSelect = true;
                StartCoroutine(dArrow.Strobe());
                dMan.bDialogueActive = true;
                sFaderAnimDia.transform.localScale = Vector3.zero; // Remove to allow mouse click on options prompts

                // Sound Effect
                SFXMan.sounds[2].PlayOneShot(SFXMan.sounds[2].clip);
            }
        }

        // Mode Selection Prompt
        if (bOptModeSelect &&
            !dMan.bDialogueActive)
        {
            GWC_PromptRestrictions();

            dialogueLines = new string[] {
                "First and first mostly, who's playing?"
            };
            GWC_DialogueResetter();

            optionsLines = new string[] {
                "Me (Single player)",
                "Us (Multiplayer)"
            };
            GWC_OptionsResetter_2Q();
        }

        // Begin play -- Activate music, UI, and fade after team selection
        if (!dMan.bDialogueActive &&
            !bAvoidUpdate &&
            bStartGame)
        {
            player.GetComponent <PlayerMovement>().bStopPlayerMovement = false;
            mMan.bMusicCanPlay = true;
            sFaderAnim.GetComponent <Animator>().enabled = true;

            // Change to avoid running this logic
            bAvoidUpdate = true;

            // Allow tile flipping
            StartCoroutine(StartFlipping());

            // Mode Reminders
            if (bOptModeMulti)
            {
                StartCoroutine(StartMulti());
            }
            if (bOptModeSingle)
            {
                StartCoroutine(StartSingle(1.0f));
            }
        }

        // Change from first music track to second
        if (bStartGame &&
            bAvoidUpdate &&
            musicTimer1 > 0)
        {
            musicTimer1 -= Time.deltaTime;

            if (musicTimer1 <= 0)
            {
                mMan.SwitchTrack(1);
            }
        }

        // Change from second music track to third
        if (musicTimer1 <= 0 &&
            musicTimer2 > 0)
        {
            musicTimer2 -= Time.deltaTime;

            if (musicTimer2 <= 0)
            {
                mMan.SwitchTrack(2);
            }
        }

        // Resetting
        if (!dMan.bDialogueActive &&
            bBoardReset &&
            !bCanFlip)
        {
            StartCoroutine(DelayedResetBoard());
        }

        // Zoom In -- Scroll Forward or press Y
        if (mainCamera.orthographicSize >= aUtil._wantedAspectRatio &&
            !dMan.bDialogueActive &&
            !pause.bPauseActive &&
            !pause.bPausing &&
            (Input.GetAxis("Mouse ScrollWheel") > 0 ||
             Input.GetKeyDown(KeyCode.Comma) ||
             //Input.GetKeyDown(KeyCode.JoystickButton3) ||
             contSupp.ControllerButtonPadTop("down") ||
             touches.bYaction))
        {
            mainCamera.orthographicSize = mainCamera.orthographicSize - 0.25f;
            touches.bYaction            = false;

            sceneTransAnim.transform.localScale = new Vector2
                                                      (sceneTransAnim.transform.localScale.x - 0.35f,
                                                      sceneTransAnim.transform.localScale.y - 0.35f);
        }

        // Zoom Out -- Scroll Back or press X
        if (mainCamera.orthographicSize < 5.642857f &&
            !dMan.bDialogueActive &&
            !pause.bPauseActive &&
            !pause.bPausing &&
            (Input.GetAxis("Mouse ScrollWheel") < 0 ||
             Input.GetKeyDown(KeyCode.Period) ||
             //Input.GetKeyDown(KeyCode.JoystickButton2) ||
             contSupp.ControllerButtonPadLeft("down") ||
             touches.bXaction))
        {
            mainCamera.orthographicSize = mainCamera.orthographicSize + 0.25f;
            touches.bXaction            = false;

            sceneTransAnim.transform.localScale = new Vector2
                                                      (sceneTransAnim.transform.localScale.x + 0.35f,
                                                      sceneTransAnim.transform.localScale.y + 0.35f);
        }

        // Single Player - Reminder to Guess
        if (bSingleReminder &&
            !dMan.bDialogueActive)
        {
            bSingleReminder     = false;
            bAllowPlayerToGuess = true;

            GWC_PromptRestrictions();

            dialogueLines = new string[] {
                "And when you're ready, just hold down for a couple of seconds."
            };
            GWC_DialogueResetter();
        }

        // Single Player - Player Guess
        if (bAllowPlayerToGuess &&
            !dMan.bDialogueActive &&
            (Input.GetKey(KeyCode.Space) ||
             Input.GetKey(KeyCode.G) ||
             Mathf.Abs(contSupp.ControllerTriggerLeft()) > 0 ||
             Mathf.Abs(contSupp.ControllerTriggerRight()) > 0 ||
             (Input.GetMouseButton(0) &&
              Input.touchCount < 2)))
        {
            buttonTimer += Time.deltaTime;

            if (buttonTimer >= guessThreshold &&
                !spLogic.bGuessingFTW)
            {
                if (spLogic.bPlayerMidGuess)
                {
                    spLogic.bPlayerGuessing = true;
                }
                else if (!bIsPlayerG2G)
                {
                    IsPlayerGoodToGuess();
                }

                buttonTimer = 0;
            }
        }

        // Single Player - Reset Player Guess timer
        if (Input.GetMouseButtonUp(0) ||
            Input.GetKeyUp(KeyCode.Space))
        {
            buttonTimer = 0;
        }
    }