Ejemplo n.º 1
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;
        }
    }
 public void MovePlayerWithController()
 {
     if (contSupp.ControllerLeftJoystickHorizontal() != 0 ||
         contSupp.ControllerLeftJoystickVertical() != 0)
     {
         Move(contSupp.ControllerLeftJoystickHorizontal(),
              contSupp.ControllerLeftJoystickVertical());
     }
     else if (contSupp.ControllerDirectionalPadHorizontal() != 0 ||
              contSupp.ControllerDirectionalPadVertical() != 0)
     {
         Move(contSupp.ControllerDirectionalPadHorizontal(),
              contSupp.ControllerDirectionalPadVertical() * -1);
     }
     else
     {
         Move(0, 0);
     }
 }
    void Update()
    {
        if (pauseCanvas.activeSelf)
        {
            // Controller Support
            if (!contSupp.bIsMoving)
            {
                bFreezeControllerInput = false;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadVertical() < 0 ||
                      contSupp.ControllerLeftJoystickVertical() < 0))
            {
                bControllerDown        = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadVertical() > 0 ||
                      contSupp.ControllerLeftJoystickVertical() > 0))
            {
                bControllerUp          = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadHorizontal() > 0 ||
                      contSupp.ControllerLeftJoystickHorizontal() > 0))
            {
                bControllerRight       = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadHorizontal() < 0 ||
                      contSupp.ControllerLeftJoystickHorizontal() < 0))
            {
                bControllerLeft        = true;
                bFreezeControllerInput = true;
            }

            if (Input.GetKeyDown(KeyCode.S) ||
                Input.GetKeyDown(KeyCode.DownArrow) ||
                bControllerDown)
            {
                bControllerDown = false;

                if (menuMain.activeSelf)
                {
                    if (currentPosition == SelectorPosition.goOn)
                    {
                        currentPosition = SelectorPosition.options;
                        mainOptionsBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.options)
                    {
                        currentPosition = SelectorPosition.end;
                        mainEndBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.end)
                    {
                        currentPosition = SelectorPosition.goOn;
                        mainGoOnBtn.Select();
                    }
                }
                else if (menuOptions.activeSelf)
                {
                    if (currentPosition == SelectorPosition.audio)
                    {
                        currentPosition = SelectorPosition.controls;
                        optsControlsBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.controls)
                    {
                        currentPosition = SelectorPosition.muor;
                        optsMuorBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.muor)
                    {
                        currentPosition = SelectorPosition.back;
                        optsBackBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.back)
                    {
                        currentPosition = SelectorPosition.audio;
                        optsAudioBtn.Select();
                    }
                }
                else if (menuAudio.activeSelf)
                {
                    if (currentPosition == SelectorPosition.volume)
                    {
                        currentPosition = SelectorPosition.music;
                        volumeSelector.transform.localScale = Vector3.zero;
                        musicSelector.transform.localScale  = Vector3.one;
                    }
                    else if (currentPosition == SelectorPosition.music)
                    {
                        currentPosition = SelectorPosition.audioBack;
                        audioBackBtn.Select();
                        musicSelector.transform.localScale = Vector3.zero;
                    }
                    else if (currentPosition == SelectorPosition.audioBack)
                    {
                        currentPosition = SelectorPosition.volume;
                        DeselectAll();
                        volumeSelector.transform.localScale = Vector3.one;
                    }
                }
                else if (menuControls.activeSelf &&
                         controlsOpacSlider)
                {
                    if (currentPosition == SelectorPosition.controlsOpacity)
                    {
                        currentPosition = SelectorPosition.controlsVibrate;
                        controlsOpaSelector.transform.localScale = Vector3.zero;
                        controlsVibSelector.transform.localScale = Vector3.one;
                    }
                    else if (currentPosition == SelectorPosition.controlsVibrate)
                    {
                        currentPosition = SelectorPosition.controlsDescription;
                        controlsVibSelector.transform.localScale  = Vector3.zero;
                        controlsDescSelector.transform.localScale = Vector3.one;
                    }
                    else if (currentPosition == SelectorPosition.controlsDescription)
                    {
                        currentPosition = SelectorPosition.controlsBack;
                        controlsDescSelector.transform.localScale = Vector3.zero;
                        controlsBackBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.controlsBack)
                    {
                        currentPosition = SelectorPosition.controlsOpacity;
                        DeselectAll();
                        controlsOpaSelector.transform.localScale = Vector3.one;
                    }
                }
                else if (menuMuor.activeSelf)
                {
                    if (currentPosition == SelectorPosition.credits)
                    {
                        currentPosition = SelectorPosition.muorBack;
                        muorBackBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.muorBack)
                    {
                        currentPosition = SelectorPosition.credits;
                        muorCreditsBtn.Select();
                    }
                }
            }
            else if (Input.GetKeyDown(KeyCode.W) ||
                     Input.GetKeyDown(KeyCode.UpArrow) ||
                     bControllerUp)
            {
                bControllerUp = false;

                if (menuMain.activeSelf)
                {
                    if (currentPosition == SelectorPosition.goOn)
                    {
                        currentPosition = SelectorPosition.end;
                        mainEndBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.options)
                    {
                        currentPosition = SelectorPosition.goOn;
                        mainGoOnBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.end)
                    {
                        currentPosition = SelectorPosition.options;
                        mainOptionsBtn.Select();
                    }
                }
                else if (menuOptions.activeSelf)
                {
                    if (currentPosition == SelectorPosition.audio)
                    {
                        currentPosition = SelectorPosition.back;
                        optsBackBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.controls)
                    {
                        currentPosition = SelectorPosition.audio;
                        optsAudioBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.muor)
                    {
                        currentPosition = SelectorPosition.controls;
                        optsControlsBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.back)
                    {
                        currentPosition = SelectorPosition.muor;
                        optsMuorBtn.Select();
                    }
                }
                else if (menuAudio.activeSelf)
                {
                    if (currentPosition == SelectorPosition.volume)
                    {
                        currentPosition = SelectorPosition.audioBack;
                        volumeSelector.transform.localScale = Vector3.zero;
                        audioBackBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.music)
                    {
                        currentPosition = SelectorPosition.volume;
                        musicSelector.transform.localScale  = Vector3.zero;
                        volumeSelector.transform.localScale = Vector3.one;
                    }
                    else if (currentPosition == SelectorPosition.audioBack)
                    {
                        currentPosition = SelectorPosition.music;
                        DeselectAll();
                        musicSelector.transform.localScale = Vector3.one;
                    }
                }
                else if (menuControls.activeSelf &&
                         controlsOpacSlider)
                {
                    if (currentPosition == SelectorPosition.controlsOpacity)
                    {
                        currentPosition = SelectorPosition.controlsBack;
                        controlsOpaSelector.transform.localScale = Vector3.zero;
                        controlsBackBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.controlsVibrate)
                    {
                        currentPosition = SelectorPosition.controlsOpacity;
                        controlsVibSelector.transform.localScale = Vector3.zero;
                        controlsOpaSelector.transform.localScale = Vector3.one;
                    }
                    else if (currentPosition == SelectorPosition.controlsDescription)
                    {
                        currentPosition = SelectorPosition.controlsVibrate;
                        controlsDescSelector.transform.localScale = Vector3.zero;
                        controlsVibSelector.transform.localScale  = Vector3.one;
                    }
                    else if (currentPosition == SelectorPosition.controlsBack)
                    {
                        currentPosition = SelectorPosition.controlsDescription;
                        DeselectAll();
                        controlsDescSelector.transform.localScale = Vector3.one;
                    }
                }
                else if (menuMuor.activeSelf)
                {
                    if (currentPosition == SelectorPosition.credits)
                    {
                        currentPosition = SelectorPosition.muorBack;
                        muorBackBtn.Select();
                    }
                    else if (currentPosition == SelectorPosition.muorBack)
                    {
                        currentPosition = SelectorPosition.credits;
                        muorCreditsBtn.Select();
                    }
                }
            }

            else if (Input.GetKeyDown(KeyCode.A) ||
                     Input.GetKeyDown(KeyCode.LeftArrow) ||
                     bControllerLeft)
            {
                bControllerLeft = false;

                if (currentPosition == SelectorPosition.volume)
                {
                    vMan.LowerVolume();
                    vMan.AdjustSliders();
                }
                else if (currentPosition == SelectorPosition.music)
                {
                    vMan.LowerMusic();
                    vMan.AdjustSliders();
                }
                else if (currentPosition == SelectorPosition.controlsOpacity)
                {
                    touches.DecreaseOpacity();
                    touches.AdjustSlider();
                }
            }
            else if (Input.GetKeyDown(KeyCode.D) ||
                     Input.GetKeyDown(KeyCode.RightArrow) ||
                     bControllerRight)
            {
                bControllerRight = false;

                if (currentPosition == SelectorPosition.volume)
                {
                    vMan.RaiseVolume();
                    vMan.AdjustSliders();
                }
                else if (currentPosition == SelectorPosition.music)
                {
                    vMan.RaiseMusic();
                    vMan.AdjustSliders();
                }
                else if (currentPosition == SelectorPosition.controlsOpacity)
                {
                    touches.IncreaseOpacity();
                    touches.AdjustSlider();
                }
            }

            else if (Input.GetButtonDown("Action") ||
                     contSupp.ControllerButtonPadBottom("down"))
            {
                if (currentPosition == SelectorPosition.goOn)
                {
                    mainGoOnBtn.onClick.Invoke();
                    //scriptMan.ResetParameters("TD_SBF_ModeSelector");
                }
                else if (currentPosition == SelectorPosition.options)
                {
                    mainOptionsBtn.onClick.Invoke();
                    DeselectAll();
                    currentPosition = SelectorPosition.audio;
                    optsAudioBtn.Select();
                }
                else if (currentPosition == SelectorPosition.end)
                {
                    mainEndBtn.onClick.Invoke();
                    DeselectAll();
                }
                else if (currentPosition == SelectorPosition.audio)
                {
                    optsAudioBtn.onClick.Invoke();
                    DeselectAll();
                    currentPosition = SelectorPosition.volume;
                    volumeSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.controls)
                {
                    optsControlsBtn.onClick.Invoke();
                    DeselectAll();

                    if (controlsOpacSlider)
                    {
                        currentPosition = SelectorPosition.controlsOpacity;
                        controlsOpaSelector.transform.localScale = Vector3.one;
                    }
                    else
                    {
                        currentPosition = SelectorPosition.controlsBack;
                        controlsBackBtn.Select();
                    }
                }
                else if (currentPosition == SelectorPosition.muor)
                {
                    optsMuorBtn.onClick.Invoke();
                    DeselectAll();
                    currentPosition = SelectorPosition.credits;
                    muorCreditsBtn.Select();
                }
                else if (currentPosition == SelectorPosition.back)
                {
                    optsBackBtn.onClick.Invoke();
                    DeselectAll();
                    currentPosition = SelectorPosition.goOn;
                    mainGoOnBtn.Select();
                }
                else if (currentPosition == SelectorPosition.audioBack)
                {
                    audioBackBtn.onClick.Invoke();
                    DeselectAll();
                    currentPosition = SelectorPosition.audio;
                    optsAudioBtn.Select();
                }
                else if (currentPosition == SelectorPosition.controlsVibrate)
                {
                    controlsVibToggle.isOn = !controlsVibToggle.isOn;
                    touches.ToggleVibrate();
                    touches.Vibrate();
                }
                else if (currentPosition == SelectorPosition.controlsBack)
                {
                    controlsBackBtn.onClick.Invoke();
                    DeselectAll();
                    currentPosition = SelectorPosition.controls;
                    optsControlsBtn.Select();
                }
                else if (currentPosition == SelectorPosition.credits)
                {
                    muorCreditsBtn.onClick.Invoke();
                    DeselectAll();
                    currentPosition = SelectorPosition.creditsBack;
                    creditsBackBtn.Select();
                }
                else if (currentPosition == SelectorPosition.muorBack)
                {
                    muorBackBtn.onClick.Invoke();
                    DeselectAll();
                    currentPosition = SelectorPosition.audio;
                    optsAudioBtn.Select();
                }
                else if (currentPosition == SelectorPosition.creditsBack)
                {
                    creditsBackBtn.onClick.Invoke();
                    DeselectAll();
                    currentPosition = SelectorPosition.credits;
                    muorCreditsBtn.Select();
                }
            }

            else if (contSupp.ControllerButtonPadRight("down"))
            {
                DeselectAll();

                if (menuMain.activeSelf)
                {
                    mainGoOnBtn.onClick.Invoke();
                }
                else if (menuOptions.activeSelf)
                {
                    pause.ToggleOptions();
                    currentPosition = SelectorPosition.goOn;
                    mainGoOnBtn.Select();
                }
                else if (menuAudio.activeSelf)
                {
                    pause.ToggleAudio();
                    currentPosition = SelectorPosition.audio;
                    optsAudioBtn.Select();
                }
                else if (menuControls.activeSelf)
                {
                    pause.ToggleControls();
                    currentPosition = SelectorPosition.audio;
                    optsAudioBtn.Select();
                }
                else if (menuMuor.activeSelf)
                {
                    pause.ToggleMuor();
                    currentPosition = SelectorPosition.audio;
                    optsAudioBtn.Select();
                }
                else if (menuCredits.activeSelf)
                {
                    pause.ToggleCredits();
                    currentPosition = SelectorPosition.credits;
                    muorCreditsBtn.Select();
                }
            }
        }

        if (contSupp.ControllerRightJoystickVertical() > 0)
        {
            if (menuControls.activeSelf)
            {
                if (menuControls.transform.GetChild(0).GetChild(0).GetChild(0).
                    GetComponent <RectTransform>().offsetMin.y < 0)
                {
                    menuControls.transform.GetChild(0).GetChild(0).GetChild(0).localPosition = new Vector3(
                        menuControls.transform.GetChild(0).GetChild(0).GetChild(0).localPosition.x,
                        menuControls.transform.GetChild(0).GetChild(0).GetChild(0).localPosition.y + 10 * contSupp.ControllerRightJoystickVertical(),
                        menuControls.transform.GetChild(0).GetChild(0).GetChild(0).localPosition.z);
                }
                else
                {
                    menuControls.transform.GetChild(0).GetChild(0).GetChild(0).
                    GetComponent <RectTransform>().offsetMin = new Vector2(
                        menuControls.transform.GetChild(0).GetChild(0).GetChild(0).
                        GetComponent <RectTransform>().offsetMin.x,
                        0);
                }
            }
            else if (menuCredits.activeSelf)
            {
                if (menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).
                    GetComponent <RectTransform>().offsetMin.y < 0)
                {
                    menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).localPosition = new Vector3(
                        menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).localPosition.x,
                        menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).localPosition.y + 10 * contSupp.ControllerRightJoystickVertical(),
                        menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).localPosition.z);
                }
                else
                {
                    menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).
                    GetComponent <RectTransform>().offsetMin = new Vector2(
                        menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).
                        GetComponent <RectTransform>().offsetMin.x,
                        0);
                }
            }
        }
        else if (contSupp.ControllerRightJoystickVertical() < 0)
        {
            if (menuControls.activeSelf)
            {
                if (menuControls.transform.GetChild(0).GetChild(0).GetChild(0).
                    GetComponent <RectTransform>().offsetMax.y * -1f < 0)
                {
                    menuControls.transform.GetChild(0).GetChild(0).GetChild(0).localPosition = new Vector3(
                        menuControls.transform.GetChild(0).GetChild(0).GetChild(0).localPosition.x,
                        menuControls.transform.GetChild(0).GetChild(0).GetChild(0).localPosition.y + 10 * contSupp.ControllerRightJoystickVertical(),
                        menuControls.transform.GetChild(0).GetChild(0).GetChild(0).localPosition.z);
                }
                else
                {
                    menuControls.transform.GetChild(0).GetChild(0).GetChild(0).
                    GetComponent <RectTransform>().offsetMax = new Vector2(
                        menuControls.transform.GetChild(0).GetChild(0).GetChild(0).
                        GetComponent <RectTransform>().offsetMax.x,
                        0);
                }
            }
            else if (menuCredits.activeSelf)
            {
                if (menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).
                    GetComponent <RectTransform>().offsetMax.y * -1f < 0)
                {
                    menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).localPosition = new Vector3(
                        menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).localPosition.x,
                        menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).localPosition.y + 10 * contSupp.ControllerRightJoystickVertical(),
                        menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).localPosition.z);
                }
                else
                {
                    menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).
                    GetComponent <RectTransform>().offsetMax = new Vector2(
                        menuCredits.transform.GetChild(0).GetChild(0).GetChild(0).
                        GetComponent <RectTransform>().offsetMax.x,
                        0);
                }
            }
        }
    }
    void Update()
    {
        if (itemMenu.gameObject.GetComponent <CanvasGroup>().alpha == 1)
        {
            // Controller Support
            if (contSupp.ControllerDirectionalPadHorizontal() == 0 &&
                contSupp.ControllerLeftJoystickHorizontal() == 0 &&
                joystick.Horizontal == 0 &&
                (!touches.bLeft &&
                 !touches.bRight))
            {
                bFreezeControllerInput = false;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadHorizontal() > 0 ||
                      contSupp.ControllerLeftJoystickHorizontal() > 0 ||
                      joystick.Horizontal > 0 ||
                      touches.bRight))
            {
                bControllerRight       = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadHorizontal() < 0 ||
                      contSupp.ControllerLeftJoystickHorizontal() < 0 ||
                      joystick.Horizontal < 0 ||
                      touches.bLeft))
            {
                bControllerLeft        = true;
                bFreezeControllerInput = true;
            }

            if (Input.GetKeyDown(KeyCode.D) ||
                Input.GetKeyDown(KeyCode.RightArrow) ||
                bControllerRight)
            {
                bControllerRight = false;

                if (currentPosition == ItemArrowPos.Use)
                {
                    currentPosition = ItemArrowPos.Drop;
                    ClearAllArrows();
                    DropArw.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
                }
                else if (currentPosition == ItemArrowPos.Drop)
                {
                    currentPosition = ItemArrowPos.Back;
                    ClearAllArrows();
                    BackArw.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
                }
            }
            else if (Input.GetKeyDown(KeyCode.A) ||
                     Input.GetKeyDown(KeyCode.LeftArrow) ||
                     bControllerLeft)
            {
                bControllerLeft = false;

                if (currentPosition == ItemArrowPos.Back)
                {
                    currentPosition = ItemArrowPos.Drop;
                    ClearAllArrows();
                    DropArw.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
                }
                else if (currentPosition == ItemArrowPos.Drop)
                {
                    currentPosition = ItemArrowPos.Use;
                    ClearAllArrows();
                    UseArw.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
                }
            }
            else if (Input.GetButtonDown("Action") ||
                     contSupp.ControllerButtonPadBottom("down") ||
                     touches.bAaction)
            {
                if (currentPosition == ItemArrowPos.Use)
                {
                    UseBtn.onClick.Invoke();
                }
                else if (currentPosition == ItemArrowPos.Drop)
                {
                    DropBtn.onClick.Invoke();
                }
                else if (currentPosition == ItemArrowPos.Back)
                {
                    BackBtn.onClick.Invoke();
                }

                moveSMA.bAllowSelection = false;
                moveSMA.bAvoidAllower   = false;
                touches.bAaction        = false;
            }
            else if (Input.GetKeyDown(KeyCode.Escape) ||
                     contSupp.ControllerMenuRight("down") ||
                     contSupp.ControllerButtonPadRight("down") ||
                     Input.GetButton("BAction") ||
                     touches.bBaction)
            {
                ResetArrowPos();
            }
        }
    }
Ejemplo n.º 5
0
    void Update()
    {
        if (controlsMenu.localScale == Vector3.one)
        {
            // Controller Support
            if (!contSupp.bIsMoving &&
                fixedJoystick.Vertical == 0 &&
                fixedJoystick.Horizontal == 0 &&
                (!touches.bDown &&
                 !touches.bUp &&
                 !touches.bLeft &&
                 !touches.bRight))
            {
                bFreezeControllerInput = false;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadVertical() < 0 ||
                      contSupp.ControllerLeftJoystickVertical() < 0 ||
                      touches.bDown ||
                      (Mathf.Abs(fixedJoystick.Vertical) > Mathf.Abs(fixedJoystick.Horizontal) &&
                       fixedJoystick.Vertical < 0)))
            {
                bControllerDown        = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadVertical() > 0 ||
                      contSupp.ControllerLeftJoystickVertical() > 0 ||
                      touches.bUp ||
                      (Mathf.Abs(fixedJoystick.Vertical) > Mathf.Abs(fixedJoystick.Horizontal) &&
                       fixedJoystick.Vertical > 0)))
            {
                bControllerUp          = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadHorizontal() > 0 ||
                      contSupp.ControllerLeftJoystickHorizontal() > 0 ||
                      fixedJoystick.Horizontal > 0 ||
                      touches.bRight))
            {
                bControllerRight       = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadHorizontal() < 0 ||
                      contSupp.ControllerLeftJoystickHorizontal() < 0 ||
                      fixedJoystick.Horizontal < 0 ||
                      touches.bLeft))
            {
                bControllerLeft        = true;
                bFreezeControllerInput = true;
            }

            if (Input.GetKeyDown(KeyCode.S) ||
                Input.GetKeyDown(KeyCode.DownArrow) ||
                bControllerDown)
            {
                bControllerDown = false;

                if (currentPosition == SelectorPosition.showButtons)
                {
                    currentPosition = SelectorPosition.opacitySlider;
                    ClearAllSelectors();
                    buttonOpacitySelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.opacitySlider)
                {
                    currentPosition = SelectorPosition.dPad;
                    ClearAllSelectors();
                    dPadSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.dPad)
                {
                    currentPosition = SelectorPosition.vibrate;
                    ClearAllSelectors();
                    vibrateSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.vibrate)
                {
                    currentPosition = SelectorPosition.description;
                    ClearAllSelectors();
                    controlsDescriptionSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.description)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.back)
                {
                    currentPosition = SelectorPosition.showButtons;
                    ClearAllSelectors();
                    showButtonsSelector.transform.localScale = Vector3.one;
                }
            }
            else if (Input.GetKeyDown(KeyCode.W) ||
                     Input.GetKeyDown(KeyCode.UpArrow) ||
                     bControllerUp)
            {
                bControllerUp = false;

                if (currentPosition == SelectorPosition.back)
                {
                    currentPosition = SelectorPosition.description;
                    ClearAllSelectors();
                    controlsDescriptionSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.description)
                {
                    currentPosition = SelectorPosition.vibrate;
                    ClearAllSelectors();
                    vibrateSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.vibrate)
                {
                    currentPosition = SelectorPosition.dPad;
                    ClearAllSelectors();
                    dPadSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.dPad)
                {
                    currentPosition = SelectorPosition.opacitySlider;
                    ClearAllSelectors();
                    buttonOpacitySelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.opacitySlider)
                {
                    currentPosition = SelectorPosition.showButtons;
                    ClearAllSelectors();
                    showButtonsSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.showButtons)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
            }
            else if (Input.GetKeyDown(KeyCode.A) ||
                     Input.GetKeyDown(KeyCode.LeftArrow) ||
                     bControllerLeft)
            {
                bControllerLeft = false;

                if (currentPosition == SelectorPosition.opacitySlider)
                {
                    uMan.DecreaseOpacity();
                }
            }
            else if (Input.GetKeyDown(KeyCode.D) ||
                     Input.GetKeyDown(KeyCode.RightArrow) ||
                     bControllerRight)
            {
                bControllerRight = false;

                if (currentPosition == SelectorPosition.opacitySlider)
                {
                    uMan.IncreaseOpacity();
                }
            }
            else if ((Input.GetButtonDown("Action") ||
                      contSupp.ControllerButtonPadBottom("down") ||
                      touches.bAaction))
            {
                if (currentPosition == SelectorPosition.showButtons)
                {
                    showButtonsToggle.isOn = !showButtonsToggle.isOn;
                    uMan.ToggleControls();
                    touches.Vibrate();
                }
                else if (currentPosition == SelectorPosition.dPad &&
                         !uMan.bOnlyDPad)
                {
                    dPadToggle.isOn = !dPadToggle.isOn;
                    uMan.ToggleDPadControl();
                    touches.Vibrate();
                }
                else if (currentPosition == SelectorPosition.vibrate)
                {
                    vibrateToggle.isOn = !vibrateToggle.isOn;
                    touches.ToggleVibrate();
                    touches.Vibrate();
                }
                else if (currentPosition == SelectorPosition.back)
                {
                    ResetSelectors();
                    movePMA.bDelayAction = true;
                    pause.Controls(false);
                }

                touches.bAaction = false;
            }
            else if (Input.GetKeyDown(KeyCode.Escape) ||
                     contSupp.ControllerMenuRight("down") ||
                     contSupp.ControllerButtonPadRight("down") ||
                     Input.GetButton("BAction") ||
                     touches.bBaction)
            {
                ResetSelectors();
            }

            if (contSupp.ControllerRightJoystickVertical() > 0)
            {
                if (controlsMenu.GetChild(0).GetChild(0).GetComponent <RectTransform>().
                    offsetMin.y < 0)
                {
                    controlsMenu.GetChild(0).GetChild(0).localPosition = new Vector3(
                        controlsMenu.GetChild(0).GetChild(0).localPosition.x,
                        controlsMenu.GetChild(0).GetChild(0).localPosition.y + 10 * contSupp.ControllerRightJoystickVertical(),
                        controlsMenu.GetChild(0).GetChild(0).localPosition.z);
                }
                else
                {
                    controlsMenu.GetChild(0).GetChild(0).GetComponent <RectTransform>().
                    offsetMin = new Vector2(controlsMenu.GetChild(0).
                                            GetChild(0).GetComponent <RectTransform>().offsetMin.x,
                                            0);
                }
            }
            else if (contSupp.ControllerRightJoystickVertical() < 0)
            {
                if (controlsMenu.GetChild(0).GetChild(0).GetComponent <RectTransform>().
                    offsetMax.y * -1f < 0)
                {
                    controlsMenu.GetChild(0).GetChild(0).localPosition = new Vector3(
                        controlsMenu.GetChild(0).GetChild(0).localPosition.x,
                        controlsMenu.GetChild(0).GetChild(0).localPosition.y + 10 * contSupp.ControllerRightJoystickVertical(),
                        controlsMenu.GetChild(0).GetChild(0).localPosition.z);
                }
                else
                {
                    controlsMenu.GetChild(0).GetChild(0).GetComponent <RectTransform>().
                    offsetMax = new Vector2(controlsMenu.GetChild(0).
                                            GetChild(0).GetComponent <RectTransform>().offsetMax.x,
                                            0);
                }
            }

            // Dev Support
            if (currentPosition == SelectorPosition.opacitySlider &&
                (Input.GetButton("Action") ||
                 contSupp.ControllerButtonPadBottom("hold") ||
                 (touches.bAvoidSubUIElements &&
                  touches.bUIactive)))
            {
                devSupportTimer -= 0.01f;

                if (devSupportTimer <= 0)
                {
                    bDevSupportActive = !bDevSupportActive;
                    ToggleDevSupport();
                }
            }
        }
    }
Ejemplo n.º 6
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 (stuffMenu.localScale == Vector3.one &&
            itemMenu.GetComponent <CanvasGroup>().alpha == 0)
        {
            // Controller Support
            if (bDelayAction)
            {
                bDelayAction = false;
                return;
            }

            // Controller Support
            if (!contSupp.bIsMoving &&
                fixedJoystick.Vertical == 0 &&
                fixedJoystick.Horizontal == 0 &&
                (!touches.bDown &&
                 !touches.bUp &&
                 !touches.bLeft &&
                 !touches.bRight))
            {
                bFreezeControllerInput = false;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadVertical() < 0 ||
                      contSupp.ControllerLeftJoystickVertical() < 0 ||
                      touches.bDown ||
                      (Mathf.Abs(fixedJoystick.Vertical) > Mathf.Abs(fixedJoystick.Horizontal) &&
                       fixedJoystick.Vertical < 0)))
            {
                bControllerDown        = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadVertical() > 0 ||
                      contSupp.ControllerLeftJoystickVertical() > 0 ||
                      touches.bUp ||
                      (Mathf.Abs(fixedJoystick.Vertical) > Mathf.Abs(fixedJoystick.Horizontal) &&
                       fixedJoystick.Vertical > 0)))
            {
                bControllerUp          = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadHorizontal() > 0 ||
                      contSupp.ControllerLeftJoystickHorizontal() > 0 ||
                      fixedJoystick.Horizontal > 0 ||
                      touches.bRight))
            {
                bControllerRight       = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadHorizontal() < 0 ||
                      contSupp.ControllerLeftJoystickHorizontal() < 0 ||
                      fixedJoystick.Horizontal < 0 ||
                      touches.bLeft))
            {
                bControllerLeft        = true;
                bFreezeControllerInput = true;
            }

            if (Input.GetKeyDown(KeyCode.S) ||
                Input.GetKeyDown(KeyCode.DownArrow) ||
                bControllerDown)
            {
                bControllerDown = false;

                if (currentPosition == SelectorPosition.item1)
                {
                    currentPosition = SelectorPosition.item6;
                    ClearAllSelectors();
                    itemSelector6.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item2)
                {
                    currentPosition = SelectorPosition.item7;
                    ClearAllSelectors();
                    itemSelector7.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item3)
                {
                    currentPosition = SelectorPosition.item8;
                    ClearAllSelectors();
                    itemSelector8.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item4)
                {
                    currentPosition = SelectorPosition.item9;
                    ClearAllSelectors();
                    itemSelector9.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item5)
                {
                    currentPosition = SelectorPosition.item10;
                    ClearAllSelectors();
                    itemSelector10.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item6)
                {
                    currentPosition = SelectorPosition.item11;
                    ClearAllSelectors();
                    itemSelector11.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item7)
                {
                    currentPosition = SelectorPosition.item12;
                    ClearAllSelectors();
                    itemSelector12.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item8)
                {
                    currentPosition = SelectorPosition.item13;
                    ClearAllSelectors();
                    itemSelector13.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item9)
                {
                    currentPosition = SelectorPosition.item14;
                    ClearAllSelectors();
                    itemSelector14.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item10)
                {
                    currentPosition = SelectorPosition.item15;
                    ClearAllSelectors();
                    itemSelector15.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item11)
                {
                    currentPosition = SelectorPosition.item16;
                    ClearAllSelectors();
                    itemSelector16.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item12)
                {
                    currentPosition = SelectorPosition.item17;
                    ClearAllSelectors();
                    itemSelector17.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item13)
                {
                    currentPosition = SelectorPosition.item18;
                    ClearAllSelectors();
                    itemSelector18.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item14)
                {
                    currentPosition = SelectorPosition.item19;
                    ClearAllSelectors();
                    itemSelector19.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item15)
                {
                    currentPosition = SelectorPosition.item20;
                    ClearAllSelectors();
                    itemSelector20.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item16)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item17)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item18)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item19)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item20)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.back)
                {
                    if (selectorColumn == 1)
                    {
                        backSelector.transform.localScale = Vector3.zero;
                        currentPosition = SelectorPosition.item1;
                        itemSelector1.transform.localScale = Vector3.one;
                    }
                    else if (selectorColumn == 2)
                    {
                        backSelector.transform.localScale = Vector3.zero;
                        currentPosition = SelectorPosition.item2;
                        itemSelector2.transform.localScale = Vector3.one;
                    }
                    else if (selectorColumn == 3)
                    {
                        backSelector.transform.localScale = Vector3.zero;
                        currentPosition = SelectorPosition.item3;
                        itemSelector3.transform.localScale = Vector3.one;
                    }
                    else if (selectorColumn == 4)
                    {
                        backSelector.transform.localScale = Vector3.zero;
                        currentPosition = SelectorPosition.item4;
                        itemSelector4.transform.localScale = Vector3.one;
                    }
                    else if (selectorColumn == 5)
                    {
                        backSelector.transform.localScale = Vector3.zero;
                        currentPosition = SelectorPosition.item5;
                        itemSelector5.transform.localScale = Vector3.one;
                    }
                }
            }
            else if (Input.GetKeyDown(KeyCode.W) ||
                     Input.GetKeyDown(KeyCode.UpArrow) ||
                     bControllerUp)
            {
                bControllerUp = false;

                if (currentPosition == SelectorPosition.item1)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item2)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item3)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item4)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item5)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }


                else if (currentPosition == SelectorPosition.item6)
                {
                    currentPosition = SelectorPosition.item1;
                    ClearAllSelectors();
                    itemSelector1.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item7)
                {
                    currentPosition = SelectorPosition.item2;
                    ClearAllSelectors();
                    itemSelector2.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item8)
                {
                    currentPosition = SelectorPosition.item3;
                    ClearAllSelectors();
                    itemSelector3.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item9)
                {
                    currentPosition = SelectorPosition.item4;
                    ClearAllSelectors();
                    itemSelector4.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item10)
                {
                    currentPosition = SelectorPosition.item5;
                    ClearAllSelectors();
                    itemSelector5.transform.localScale = Vector3.one;
                }


                else if (currentPosition == SelectorPosition.item11)
                {
                    currentPosition = SelectorPosition.item6;
                    ClearAllSelectors();
                    itemSelector6.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item12)
                {
                    currentPosition = SelectorPosition.item7;
                    ClearAllSelectors();
                    itemSelector7.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item13)
                {
                    currentPosition = SelectorPosition.item8;
                    ClearAllSelectors();
                    itemSelector8.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item14)
                {
                    currentPosition = SelectorPosition.item9;
                    ClearAllSelectors();
                    itemSelector9.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item15)
                {
                    currentPosition = SelectorPosition.item10;
                    ClearAllSelectors();
                    itemSelector10.transform.localScale = Vector3.one;
                }


                else if (currentPosition == SelectorPosition.item16)
                {
                    currentPosition = SelectorPosition.item11;
                    ClearAllSelectors();
                    itemSelector11.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item17)
                {
                    currentPosition = SelectorPosition.item12;
                    ClearAllSelectors();
                    itemSelector12.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item18)
                {
                    currentPosition = SelectorPosition.item13;
                    ClearAllSelectors();
                    itemSelector13.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item19)
                {
                    currentPosition = SelectorPosition.item14;
                    ClearAllSelectors();
                    itemSelector14.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item20)
                {
                    currentPosition = SelectorPosition.item15;
                    ClearAllSelectors();
                    itemSelector15.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.back)
                {
                    if (selectorColumn == 1)
                    {
                        backSelector.transform.localScale = Vector3.zero;
                        currentPosition = SelectorPosition.item16;
                        itemSelector16.transform.localScale = Vector3.one;
                    }
                    else if (selectorColumn == 2)
                    {
                        backSelector.transform.localScale = Vector3.zero;
                        currentPosition = SelectorPosition.item17;
                        itemSelector17.transform.localScale = Vector3.one;
                    }
                    else if (selectorColumn == 3)
                    {
                        backSelector.transform.localScale = Vector3.zero;
                        currentPosition = SelectorPosition.item18;
                        itemSelector18.transform.localScale = Vector3.one;
                    }
                    else if (selectorColumn == 4)
                    {
                        backSelector.transform.localScale = Vector3.zero;
                        currentPosition = SelectorPosition.item19;
                        itemSelector19.transform.localScale = Vector3.one;
                    }
                    else if (selectorColumn == 5)
                    {
                        backSelector.transform.localScale = Vector3.zero;
                        currentPosition = SelectorPosition.item20;
                        itemSelector20.transform.localScale = Vector3.one;
                    }
                }
            }
            else if (Input.GetKeyDown(KeyCode.A) ||
                     Input.GetKeyDown(KeyCode.LeftArrow) ||
                     bControllerLeft)
            {
                bControllerLeft = false;

                if (currentPosition == SelectorPosition.item1)
                {
                    currentPosition = SelectorPosition.item5;
                    selectorColumn  = 5;
                    ClearAllSelectors();
                    itemSelector5.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item2)
                {
                    currentPosition = SelectorPosition.item1;
                    selectorColumn  = 1;
                    ClearAllSelectors();
                    itemSelector1.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item3)
                {
                    currentPosition = SelectorPosition.item2;
                    selectorColumn  = 2;
                    ClearAllSelectors();
                    itemSelector2.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item4)
                {
                    currentPosition = SelectorPosition.item3;
                    selectorColumn  = 3;
                    ClearAllSelectors();
                    itemSelector3.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item5)
                {
                    currentPosition = SelectorPosition.item4;
                    selectorColumn  = 4;
                    ClearAllSelectors();
                    itemSelector4.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item6)
                {
                    currentPosition = SelectorPosition.item10;
                    selectorColumn  = 5;
                    ClearAllSelectors();
                    itemSelector10.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item7)
                {
                    currentPosition = SelectorPosition.item6;
                    selectorColumn  = 1;
                    ClearAllSelectors();
                    itemSelector6.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item8)
                {
                    currentPosition = SelectorPosition.item7;
                    selectorColumn  = 2;
                    ClearAllSelectors();
                    itemSelector7.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item9)
                {
                    currentPosition = SelectorPosition.item8;
                    selectorColumn  = 3;
                    ClearAllSelectors();
                    itemSelector8.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item10)
                {
                    currentPosition = SelectorPosition.item9;
                    selectorColumn  = 4;
                    ClearAllSelectors();
                    itemSelector9.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item11)
                {
                    currentPosition = SelectorPosition.item15;
                    selectorColumn  = 5;
                    ClearAllSelectors();
                    itemSelector15.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item12)
                {
                    currentPosition = SelectorPosition.item11;
                    selectorColumn  = 1;
                    ClearAllSelectors();
                    itemSelector11.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item13)
                {
                    currentPosition = SelectorPosition.item12;
                    selectorColumn  = 2;
                    ClearAllSelectors();
                    itemSelector12.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item14)
                {
                    currentPosition = SelectorPosition.item13;
                    selectorColumn  = 3;
                    ClearAllSelectors();
                    itemSelector13.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item15)
                {
                    currentPosition = SelectorPosition.item14;
                    selectorColumn  = 4;
                    ClearAllSelectors();
                    itemSelector14.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item16)
                {
                    currentPosition = SelectorPosition.item20;
                    selectorColumn  = 5;
                    ClearAllSelectors();
                    itemSelector20.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item17)
                {
                    currentPosition = SelectorPosition.item16;
                    selectorColumn  = 1;
                    ClearAllSelectors();
                    itemSelector16.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item18)
                {
                    currentPosition = SelectorPosition.item17;
                    selectorColumn  = 2;
                    ClearAllSelectors();
                    itemSelector17.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item19)
                {
                    currentPosition = SelectorPosition.item18;
                    selectorColumn  = 3;
                    ClearAllSelectors();
                    itemSelector18.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item20)
                {
                    currentPosition = SelectorPosition.item19;
                    selectorColumn  = 4;
                    ClearAllSelectors();
                    itemSelector19.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.back)
                {
                    if (selectorColumn == 1)
                    {
                        selectorColumn = 5;
                    }
                    else if (selectorColumn == 2)
                    {
                        selectorColumn = 1;
                    }
                    else if (selectorColumn == 3)
                    {
                        selectorColumn = 2;
                    }
                    else if (selectorColumn == 4)
                    {
                        selectorColumn = 3;
                    }
                    else if (selectorColumn == 5)
                    {
                        selectorColumn = 4;
                    }
                }
            }
            else if (Input.GetKeyDown(KeyCode.D) ||
                     Input.GetKeyDown(KeyCode.RightArrow) ||
                     bControllerRight)
            {
                bControllerRight = false;

                if (currentPosition == SelectorPosition.item1)
                {
                    currentPosition = SelectorPosition.item2;
                    selectorColumn  = 2;
                    ClearAllSelectors();
                    itemSelector2.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item2)
                {
                    currentPosition = SelectorPosition.item3;
                    selectorColumn  = 3;
                    ClearAllSelectors();
                    itemSelector3.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item3)
                {
                    currentPosition = SelectorPosition.item4;
                    selectorColumn  = 4;
                    ClearAllSelectors();
                    itemSelector4.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item4)
                {
                    currentPosition = SelectorPosition.item5;
                    selectorColumn  = 5;
                    ClearAllSelectors();
                    itemSelector5.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item5)
                {
                    currentPosition = SelectorPosition.item1;
                    selectorColumn  = 1;
                    ClearAllSelectors();
                    itemSelector1.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item6)
                {
                    currentPosition = SelectorPosition.item7;
                    selectorColumn  = 2;
                    ClearAllSelectors();
                    itemSelector7.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item7)
                {
                    currentPosition = SelectorPosition.item8;
                    selectorColumn  = 3;
                    ClearAllSelectors();
                    itemSelector8.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item8)
                {
                    currentPosition = SelectorPosition.item9;
                    selectorColumn  = 4;
                    ClearAllSelectors();
                    itemSelector9.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item9)
                {
                    currentPosition = SelectorPosition.item10;
                    selectorColumn  = 5;
                    ClearAllSelectors();
                    itemSelector10.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item10)
                {
                    currentPosition = SelectorPosition.item6;
                    selectorColumn  = 1;
                    ClearAllSelectors();
                    itemSelector6.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item11)
                {
                    currentPosition = SelectorPosition.item12;
                    selectorColumn  = 2;
                    ClearAllSelectors();
                    itemSelector12.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item12)
                {
                    currentPosition = SelectorPosition.item13;
                    selectorColumn  = 3;
                    ClearAllSelectors();
                    itemSelector13.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item13)
                {
                    currentPosition = SelectorPosition.item14;
                    selectorColumn  = 4;
                    ClearAllSelectors();
                    itemSelector14.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item14)
                {
                    currentPosition = SelectorPosition.item15;
                    selectorColumn  = 5;
                    ClearAllSelectors();
                    itemSelector15.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item15)
                {
                    currentPosition = SelectorPosition.item11;
                    selectorColumn  = 1;
                    ClearAllSelectors();
                    itemSelector11.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item16)
                {
                    currentPosition = SelectorPosition.item17;
                    selectorColumn  = 2;
                    ClearAllSelectors();
                    itemSelector17.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item17)
                {
                    currentPosition = SelectorPosition.item18;
                    selectorColumn  = 3;
                    ClearAllSelectors();
                    itemSelector18.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item18)
                {
                    currentPosition = SelectorPosition.item19;
                    selectorColumn  = 4;
                    ClearAllSelectors();
                    itemSelector19.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item19)
                {
                    currentPosition = SelectorPosition.item20;
                    selectorColumn  = 5;
                    ClearAllSelectors();
                    itemSelector20.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.item20)
                {
                    currentPosition = SelectorPosition.item16;
                    selectorColumn  = 1;
                    ClearAllSelectors();
                    itemSelector16.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.back)
                {
                    if (selectorColumn == 1)
                    {
                        selectorColumn = 2;
                    }
                    else if (selectorColumn == 2)
                    {
                        selectorColumn = 3;
                    }
                    else if (selectorColumn == 3)
                    {
                        selectorColumn = 4;
                    }
                    else if (selectorColumn == 4)
                    {
                        selectorColumn = 5;
                    }
                    else if (selectorColumn == 5)
                    {
                        selectorColumn = 1;
                    }
                }
            }
            else if (bAllowSelection &&
                     (Input.GetButtonDown("Action") ||
                      contSupp.ControllerButtonPadBottom("down") ||
                      touches.bAaction))
            {
                if (currentPosition == SelectorPosition.item1)
                {
                    item1.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item2)
                {
                    item2.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item3)
                {
                    item3.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item4)
                {
                    item4.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item5)
                {
                    item5.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item6)
                {
                    item6.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item7)
                {
                    item7.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item8)
                {
                    item8.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item9)
                {
                    item9.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item10)
                {
                    item10.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item11)
                {
                    item11.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item12)
                {
                    item12.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item13)
                {
                    item13.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item14)
                {
                    item14.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item15)
                {
                    item15.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item16)
                {
                    item16.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item17)
                {
                    item17.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item18)
                {
                    item18.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item19)
                {
                    item19.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.item20)
                {
                    item20.onClick.Invoke();
                }
                else if (currentPosition == SelectorPosition.back)
                {
                    ResetSelectors();
                    movePMA.bDelayAction = true;
                    bDelayAction         = true;
                    pause.Stuff(false);
                }

                touches.bAaction = false;
            }
            else if (Input.GetKeyDown(KeyCode.Escape) ||
                     contSupp.ControllerMenuRight("down") ||
                     contSupp.ControllerButtonPadRight("down") ||
                     Input.GetButton("BAction") ||
                     touches.bBaction)
            {
                ResetSelectors();
            }

            if (!bAvoidAllower)
            {
                bAvoidAllower   = true;
                bAllowSelection = true;
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (controlsMenu.localScale == Vector3.one)
        {
            // Controller Support
            if (!contSupp.bIsMoving &&
                fixedJoystickLeft.Vertical == 0 &&
                fixedJoystickLeft.Horizontal == 0)
            {
                bFreezeControllerInput = false;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadVertical() < 0 ||
                      contSupp.ControllerLeftJoystickVertical() < 0 ||
                      (Mathf.Abs(fixedJoystickLeft.Vertical) > Mathf.Abs(fixedJoystickLeft.Horizontal) &&
                       fixedJoystickLeft.Vertical < 0)))
            {
                bControllerDown        = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadVertical() > 0 ||
                      contSupp.ControllerLeftJoystickVertical() > 0 ||
                      (Mathf.Abs(fixedJoystickRight.Vertical) > Mathf.Abs(fixedJoystickRight.Horizontal) &&
                       fixedJoystickRight.Vertical > 0)))
            {
                bControllerUp          = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadHorizontal() > 0 ||
                      contSupp.ControllerLeftJoystickHorizontal() > 0 ||
                      fixedJoystickLeft.Horizontal > 0))
            {
                bControllerRight       = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadHorizontal() < 0 ||
                      contSupp.ControllerLeftJoystickHorizontal() < 0 ||
                      fixedJoystickLeft.Horizontal < 0))
            {
                bControllerLeft        = true;
                bFreezeControllerInput = true;
            }

            if (Input.GetKeyDown(KeyCode.S) ||
                Input.GetKeyDown(KeyCode.DownArrow) ||
                bControllerDown)
            {
                bControllerDown = false;

                if (currentPosition == SelectorPosition.opacitySlider)
                {
                    currentPosition = SelectorPosition.vibrate;
                    ClearAllSelectors();
                    vibrateSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.vibrate)
                {
                    currentPosition = SelectorPosition.description;
                    ClearAllSelectors();
                    controlsDescriptionSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.description)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.back)
                {
                    currentPosition = SelectorPosition.opacitySlider;
                    ClearAllSelectors();
                    buttonOpacitySelector.transform.localScale = Vector3.one;
                }
            }
            else if (Input.GetKeyDown(KeyCode.W) ||
                     Input.GetKeyDown(KeyCode.UpArrow) ||
                     bControllerUp)
            {
                bControllerUp = false;

                if (currentPosition == SelectorPosition.opacitySlider)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.vibrate)
                {
                    currentPosition = SelectorPosition.opacitySlider;
                    ClearAllSelectors();
                    buttonOpacitySelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.description)
                {
                    currentPosition = SelectorPosition.vibrate;
                    ClearAllSelectors();
                    vibrateSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.back)
                {
                    currentPosition = SelectorPosition.description;
                    ClearAllSelectors();
                    controlsDescriptionSelector.transform.localScale = Vector3.one;
                }
            }
            else if (Input.GetKeyDown(KeyCode.A) ||
                     Input.GetKeyDown(KeyCode.LeftArrow) ||
                     bControllerLeft)
            {
                bControllerLeft = false;

                if (currentPosition == SelectorPosition.opacitySlider)
                {
                    touches.DecreaseOpacity();
                }
            }
            else if (Input.GetKeyDown(KeyCode.D) ||
                     Input.GetKeyDown(KeyCode.RightArrow) ||
                     bControllerRight)
            {
                bControllerRight = false;

                if (currentPosition == SelectorPosition.opacitySlider)
                {
                    touches.IncreaseOpacity();
                }
            }
            else if (Input.GetButtonDown("Action") ||
                     contSupp.ControllerButtonPadBottom("down"))
            {
                if (currentPosition == SelectorPosition.vibrate)
                {
                    vibrateToggle.isOn = !vibrateToggle.isOn;
                    touches.ToggleVibrate();
                    touches.Vibrate();
                }
                else if (currentPosition == SelectorPosition.back)
                {
                    ResetSelectors();
                    //movePMA.bDelayAction = true; // DC TODO
                    pause.ToggleControls();
                }
            }
            else if (Input.GetKeyDown(KeyCode.Escape) ||
                     contSupp.ControllerMenuRight("down") ||
                     contSupp.ControllerButtonPadRight("down") ||
                     Input.GetButton("BAction"))
            {
                ResetSelectors();
            }

            if (contSupp.ControllerRightJoystickVertical() > 0)
            {
                if (controlsMenu.GetChild(0).GetChild(0).GetComponent <RectTransform>().
                    offsetMin.y < 0)
                {
                    controlsMenu.GetChild(0).GetChild(0).localPosition = new Vector3(
                        controlsMenu.GetChild(0).GetChild(0).localPosition.x,
                        controlsMenu.GetChild(0).GetChild(0).localPosition.y + 10 * contSupp.ControllerRightJoystickVertical(),
                        controlsMenu.GetChild(0).GetChild(0).localPosition.z);
                }
                else
                {
                    controlsMenu.GetChild(0).GetChild(0).GetComponent <RectTransform>().
                    offsetMin = new Vector2(controlsMenu.GetChild(0).
                                            GetChild(0).GetComponent <RectTransform>().offsetMin.x,
                                            0);
                }
            }
            else if (contSupp.ControllerRightJoystickVertical() < 0)
            {
                if (controlsMenu.GetChild(0).GetChild(0).GetComponent <RectTransform>().
                    offsetMax.y * -1f < 0)
                {
                    controlsMenu.GetChild(0).GetChild(0).localPosition = new Vector3(
                        controlsMenu.GetChild(0).GetChild(0).localPosition.x,
                        controlsMenu.GetChild(0).GetChild(0).localPosition.y + 10 * contSupp.ControllerRightJoystickVertical(),
                        controlsMenu.GetChild(0).GetChild(0).localPosition.z);
                }
                else
                {
                    controlsMenu.GetChild(0).GetChild(0).GetComponent <RectTransform>().
                    offsetMax = new Vector2(controlsMenu.GetChild(0).
                                            GetChild(0).GetComponent <RectTransform>().offsetMax.x,
                                            0);
                }
            }
        }
    }
    void Update()
    {
        //if (contSupp.ControllerButtonPadBottom("down"))
        //{
        //    Debug.Log("bIsSelectable: " + bIsSelectable);
        //    Debug.Log("bAvoidSelection: " + bAvoidSelection);
        //}

        // Skip animations
        if ((Input.GetKeyDown(KeyCode.Space) ||
             Input.GetMouseButtonDown(0) ||
             contSupp.ControllerButtonPadBottom("down") ||
             contSupp.ControllerButtonPadRight("down")) &&
            danFace.GetComponent <CanvasRenderer>().GetAlpha() != 1f)
        {
            starExploding.GetComponent <Animator>().enabled   = false;
            starExploding.GetComponent <ImageFader>().enabled = false;
            starExploding.GetComponent <Image>().enabled      = false;

            whiteness.GetComponent <ImageFader>().enabled = false;
            whiteness.GetComponent <Image>().enabled      = false;

            spaceTwinkling.GetComponent <ImageFader>().enabled = false;
            spaceTwinkling.GetComponent <Image>().enabled      = false;

            spaceMoving.GetComponent <ImageFader>().enabled = false;
            spaceMoving.GetComponent <CanvasRenderer>().SetAlpha(1f);

            smokeRings.GetComponent <ImageFader>().enabled = false;
            smokeRings.GetComponent <CanvasRenderer>().SetAlpha(1f);

            title.GetComponent <ImageFader>().enabled = false;
            title.GetComponent <CanvasRenderer>().SetAlpha(1f);

            danFace.GetComponent <ImageFader>().enabled = false;
            danFace.GetComponent <CanvasRenderer>().SetAlpha(1f);

            endB.GetComponent <ImageFader>().enabled = false;
            endB.GetComponent <CanvasRenderer>().SetAlpha(1f);

            if (bHasSavedData)
            {
                goOnB.GetComponent <ImageFader>().enabled = false;
                goOnB.GetComponent <CanvasRenderer>().SetAlpha(1f);

                newB.GetComponent <ImageFader>().enabled = false;
                newB.GetComponent <CanvasRenderer>().SetAlpha(1f);
            }
            else
            {
                startB.GetComponent <ImageFader>().enabled = false;
                startB.GetComponent <CanvasRenderer>().SetAlpha(1f);
            }

            StartCoroutine(DelaySelectable());
        }

        if ((contSupp.ControllerButtonPadBottom("down") ||
             Input.GetKeyDown(KeyCode.Space)) &&
            bIsSelectable)
        {
            //Debug.Log("selecting...");
            SelectOption();
        }

        // Controller Support
        // DC TODO -- Controller wide support for drift
        // Noticed here, but is present everywhere (other menus, walking, etc.)
        // Drift causes the bFreeze to "malfunction" and the stick has to be toggled to free it
        // Should re-work my controller logic or find a way to "clear" drift
        if (!contSupp.bIsMoving)
        {
            bFreezeControllerInput = false;
        }

        else if (!bFreezeControllerInput &&
                 (contSupp.ControllerDirectionalPadVertical() < 0 ||
                  contSupp.ControllerLeftJoystickVertical() < 0))
        {
            bControllerDown        = true;
            bFreezeControllerInput = true;
        }
        else if (!bFreezeControllerInput &&
                 (contSupp.ControllerDirectionalPadVertical() > 0 ||
                  contSupp.ControllerLeftJoystickVertical() > 0))
        {
            bControllerUp          = true;
            bFreezeControllerInput = true;
        }
        else if (!bFreezeControllerInput &&
                 (contSupp.ControllerDirectionalPadHorizontal() > 0 ||
                  contSupp.ControllerLeftJoystickHorizontal() > 0))
        {
            bControllerRight       = true;
            bFreezeControllerInput = true;
        }
        else if (!bFreezeControllerInput &&
                 (contSupp.ControllerDirectionalPadHorizontal() < 0 ||
                  contSupp.ControllerLeftJoystickHorizontal() < 0))
        {
            bControllerLeft        = true;
            bFreezeControllerInput = true;
        }

        if (Input.GetKeyDown(KeyCode.S) ||
            Input.GetKeyDown(KeyCode.DownArrow) ||
            bControllerDown)
        {
            bControllerDown = false;
            //bAvoidSelection = false;

            if (bIsSelectable)
            {
                MoveDown();
            }
        }
        else if (Input.GetKeyDown(KeyCode.W) ||
                 Input.GetKeyDown(KeyCode.UpArrow) ||
                 bControllerUp)
        {
            bControllerUp = false;
            //bAvoidSelection = false;

            if (bIsSelectable)
            {
                MoveUp();
            }
        }
        else if (Input.GetKeyDown(KeyCode.A) ||
                 Input.GetKeyDown(KeyCode.LeftArrow) ||
                 bControllerLeft)
        {
            bControllerLeft = false;
            //bAvoidSelection = false;

            if (bIsSelectable)
            {
                MoveLeft();
            }
        }
        else if (Input.GetKeyDown(KeyCode.D) ||
                 Input.GetKeyDown(KeyCode.RightArrow) ||
                 bControllerRight)
        {
            bControllerRight = false;
            //bAvoidSelection = false;

            if (bIsSelectable)
            {
                MoveRight();
            }
        }
    }
    void Update()
    {
        if (TD_SBF_GameManagement.IsGameOver ||
            TD_SBF_GameManagement.IsLevelWon)
        {
            enabled = false;
            return;
        }

        if (!gMan.bIsHeroMode)
        {
            // Up
            if (Input.GetKey(KeyCode.W) ||
                Input.GetKey(KeyCode.UpArrow) ||
                (contSupp.bIsMoving &&
                 (contSupp.ControllerLeftJoystickVertical() > 0 ||
                  contSupp.ControllerDirectionalPadVertical() > 0)))
            {
                transform.Translate(Vector2.up * panSpeed * Time.deltaTime, Space.World);
            }

            // Down
            if (Input.GetKey(KeyCode.S) ||
                Input.GetKey(KeyCode.DownArrow) ||
                (contSupp.bIsMoving &&
                 (contSupp.ControllerLeftJoystickVertical() < 0 ||
                  contSupp.ControllerDirectionalPadVertical() < 0)))
            {
                transform.Translate(Vector2.down * panSpeed * Time.deltaTime, Space.World);
            }

            // Right
            if (Input.GetKey(KeyCode.D) ||
                Input.GetKey(KeyCode.RightArrow) ||
                (contSupp.bIsMoving &&
                 (contSupp.ControllerLeftJoystickHorizontal() > 0 ||
                  contSupp.ControllerDirectionalPadHorizontal() > 0)))
            {
                transform.Translate(Vector2.right * panSpeed * Time.deltaTime, Space.World);
            }

            // Left
            if (Input.GetKey(KeyCode.A) ||
                Input.GetKey(KeyCode.LeftArrow) ||
                (contSupp.bIsMoving &&
                 (contSupp.ControllerLeftJoystickHorizontal() < 0 ||
                  contSupp.ControllerDirectionalPadHorizontal() < 0)))
            {
                transform.Translate(Vector2.left * panSpeed * Time.deltaTime, Space.World);
            }

            // Need to handle virtual joystick movement seperately, i.e. too jarring otherwise
            if (touchConts.leftFixedJoystick.bJoying)
            {
                VirtualJoystickMove();
            }

            CalcPosition();

            // Click and drag (mouse)
            if (!devDetect.bIsMobile)
            {
                if (EventSystem.current.IsPointerOverGameObject())
                {
                    return;
                }

                if (Input.GetMouseButtonDown(0) ||
                    Input.GetMouseButtonDown(1))
                {
                    lastPosition = Input.mousePosition;
                }

                if (Input.GetMouseButton(0) ||
                    Input.GetMouseButton(1))
                {
                    Vector3 delta = Input.mousePosition - lastPosition;
                    transform.Translate(-delta.x * mouseSensitivity, -delta.y * mouseSensitivity, -10);
                    lastPosition = Input.mousePosition;
                }
            }

            // Click and drag (touch)
            if (Input.touchCount == 1)
            {
                if (tPlacer.CheckMobileAndGUIAndBail(Input.GetTouch(0).position))
                {
                    return;
                }

                if (Input.GetTouch(0).phase == TouchPhase.Began)
                {
                    lastPosition = new Vector3(
                        Input.GetTouch(0).position.x,
                        Input.GetTouch(0).position.y,
                        0);
                }

                if (Input.GetTouch(0).phase == TouchPhase.Moved)
                {
                    Vector3 delta = new Vector3(Input.GetTouch(0).position.x,
                                                Input.GetTouch(0).position.y,
                                                1) - lastPosition;
                    transform.Translate(-delta.x * mobileSensitivity, -delta.y * mobileSensitivity, -10);
                    lastPosition = Input.mousePosition;
                }
            }

            // Pinch and zoom
            if (!cMan.bAvoidCamScroll &&
                Input.touchCount == 2)
            {
                // Store both touches.
                Touch touchZero = Input.GetTouch(0);
                Touch touchOne  = Input.GetTouch(1);

                // Find the position in the previous frame of each touch.
                Vector2 touchZeroPrevPos = touchZero.position - touchZero.deltaPosition;
                Vector2 touchOnePrevPos  = touchOne.position - touchOne.deltaPosition;

                // Find the magnitude of the vector (the distance) between the touches in each frame.
                float prevTouchDeltaMag = (touchZeroPrevPos - touchOnePrevPos).magnitude;
                float touchDeltaMag     = (touchZero.position - touchOne.position).magnitude;

                // Find the difference in the distances between each frame.
                float deltaMagnitudeDiff = prevTouchDeltaMag - touchDeltaMag;

                // If the camera is orthographic...
                if (gameObject.GetComponent <Camera>().orthographic)
                {
                    // ... change the orthographic size based on the change in distance between the touches.
                    gameObject.GetComponent <Camera>().orthographicSize += deltaMagnitudeDiff * orthoZoomSpeed;

                    // Make sure the orthographic size never drops below zero.
                    gameObject.GetComponent <Camera>().orthographicSize =
                        Mathf.Clamp(gameObject.GetComponent <Camera>().orthographicSize, 5f, 50f);
                }
                // DC 02/22/2019 -- This "should" never run
                else
                {
                    // Otherwise change the field of view based on the change in distance between the touches.
                    gameObject.GetComponent <Camera>().fieldOfView += deltaMagnitudeDiff * perspectiveZoomSpeed;

                    // Clamp the field of view to make sure it's between 0 and 180.
                    gameObject.GetComponent <Camera>().fieldOfView =
                        Mathf.Clamp(gameObject.GetComponent <Camera>().fieldOfView, 0.1f, 179.9f);
                }
            }
        }

        // Mouse
        if (!cMan.bAvoidCamScroll &&
            (Input.GetAxis("Mouse ScrollWheel") != 0 ||
             touchConts.rightFixedJoystick.Vertical != 0))
        {
            float scroll = 0;

            if (Input.GetAxis("Mouse ScrollWheel") != 0)
            {
                scroll = Input.GetAxis("Mouse ScrollWheel");
            }
            else
            {
                scroll = touchConts.rightFixedJoystick.Vertical * 0.05f;
            }

            // TODO - Investigate why mobile "locks" up on the zoom

            // Zoom In
            if (scroll > 0 &&
                GetComponent <Camera>().orthographicSize > 5)
            {
                GetComponent <Camera>().orthographicSize -=
                    scroll * 100 * scrollSpeed * Time.deltaTime;
            }

            // Zoom Out
            if (scroll < 0 &&
                GetComponent <Camera>().orthographicSize < 50)
            {
                GetComponent <Camera>().orthographicSize -=
                    scroll * 100 * scrollSpeed * Time.deltaTime;
            }

            if (GetComponent <Camera>().orthographicSize < 0)
            {
                GetComponent <Camera>().orthographicSize = 5f;
            }
            else if (GetComponent <Camera>().orthographicSize > 50)
            {
                GetComponent <Camera>().orthographicSize = 50f;
            }
        }

        // Controller
        if (!cMan.bAvoidCamScroll &&
            //Input.GetAxis("Controller Right Trigger") > 0)
            contSupp.ControllerTriggerRight() > 0)
        {
            //float scroll = Input.GetAxis("Controller Right Trigger");
            float scroll = contSupp.ControllerTriggerRight();

            // Zoom In
            if (scroll > 0 &&
                GetComponent <Camera>().orthographicSize > 5)
            {
                GetComponent <Camera>().orthographicSize -=
                    scroll * 5 * scrollSpeed * Time.deltaTime;
            }

            if (GetComponent <Camera>().orthographicSize < 0)
            {
                GetComponent <Camera>().orthographicSize = 5f;
            }
        }

        // Controller
        if (!cMan.bAvoidCamScroll &&
            //Input.GetAxis("Controller Left Trigger") > 0)
            contSupp.ControllerTriggerLeft() > 0)
        {
            //float scroll = Input.GetAxis("Controller Left Trigger");
            float scroll = contSupp.ControllerTriggerLeft();

            // Zoom Out
            if (scroll > 0 &&
                GetComponent <Camera>().orthographicSize < 50)
            {
                GetComponent <Camera>().orthographicSize +=
                    scroll * 5 * scrollSpeed * Time.deltaTime;
            }

            if (GetComponent <Camera>().orthographicSize > 50)
            {
                GetComponent <Camera>().orthographicSize = 50f;
            }
        }
    }
    void Update()
    {
        if (soundMenu.localScale == Vector3.one)
        {
            // Controller Support
            if (!contSupp.bIsMoving &&
                fixedJoystick.Vertical == 0 &&
                fixedJoystick.Horizontal == 0 &&
                (!touches.bDown &&
                 !touches.bUp &&
                 !touches.bLeft &&
                 !touches.bRight))
            {
                bFreezeControllerInput = false;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadVertical() < 0 ||
                      contSupp.ControllerLeftJoystickVertical() < 0 ||
                      touches.bDown ||
                      (Mathf.Abs(fixedJoystick.Vertical) > Mathf.Abs(fixedJoystick.Horizontal) &&
                       fixedJoystick.Vertical < 0)))
            {
                bControllerDown        = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadVertical() > 0 ||
                      contSupp.ControllerLeftJoystickVertical() > 0 ||
                      touches.bUp ||
                      (Mathf.Abs(fixedJoystick.Vertical) > Mathf.Abs(fixedJoystick.Horizontal) &&
                       fixedJoystick.Vertical > 0)))
            {
                bControllerUp          = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadHorizontal() > 0 ||
                      contSupp.ControllerLeftJoystickHorizontal() > 0 ||
                      fixedJoystick.Horizontal > 0 ||
                      touches.bRight))
            {
                bControllerRight       = true;
                bFreezeControllerInput = true;
            }
            else if (!bFreezeControllerInput &&
                     (contSupp.ControllerDirectionalPadHorizontal() < 0 ||
                      contSupp.ControllerLeftJoystickHorizontal() < 0 ||
                      fixedJoystick.Horizontal < 0 ||
                      touches.bLeft))
            {
                bControllerLeft        = true;
                bFreezeControllerInput = true;
            }

            if (Input.GetKeyDown(KeyCode.S) ||
                Input.GetKeyDown(KeyCode.DownArrow) ||
                bControllerDown)
            {
                bControllerDown = false;

                if (currentPosition == SelectorPosition.volumeSlider)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.back)
                {
                    currentPosition = SelectorPosition.volumeSlider;
                    ClearAllSelectors();
                    volumeSelector.transform.localScale = Vector3.one;
                }
            }
            else if (Input.GetKeyDown(KeyCode.W) ||
                     Input.GetKeyDown(KeyCode.UpArrow) ||
                     bControllerUp)
            {
                bControllerUp = false;

                if (currentPosition == SelectorPosition.volumeSlider)
                {
                    currentPosition = SelectorPosition.back;
                    ClearAllSelectors();
                    backSelector.transform.localScale = Vector3.one;
                }
                else if (currentPosition == SelectorPosition.back)
                {
                    currentPosition = SelectorPosition.volumeSlider;
                    ClearAllSelectors();
                    volumeSelector.transform.localScale = Vector3.one;
                }
            }
            else if (Input.GetKeyDown(KeyCode.A) ||
                     Input.GetKeyDown(KeyCode.LeftArrow) ||
                     bControllerLeft)
            {
                bControllerLeft = false;

                if (currentPosition == SelectorPosition.volumeSlider)
                {
                    vMan.LowerVolume();
                }
            }
            else if (Input.GetKeyDown(KeyCode.D) ||
                     Input.GetKeyDown(KeyCode.RightArrow) ||
                     bControllerRight)
            {
                bControllerRight = false;

                if (currentPosition == SelectorPosition.volumeSlider)
                {
                    vMan.RaiseVolume();
                }
            }
            else if ((Input.GetButtonDown("Action") ||
                      contSupp.ControllerButtonPadBottom("down") ||
                      touches.bAaction))
            {
                if (currentPosition == SelectorPosition.back)
                {
                    ResetSelectors();
                    movePMA.bDelayAction = true;
                    pause.Sound(false);
                }

                touches.bAaction = false;
            }
            else if (Input.GetKeyDown(KeyCode.Escape) ||
                     contSupp.ControllerMenuRight("down") ||
                     contSupp.ControllerButtonPadRight("down") ||
                     Input.GetButton("BAction") ||
                     touches.bBaction)
            {
                ResetSelectors();
            }
        }
    }