コード例 #1
0
        void Update()
        {
            if (EventSystem.current.currentSelectedGameObject == null)
            {
                EventSystem.current.SetSelectedGameObject(button);
            }

            if (currentImage > 0 && Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Left))
            {
                RightShift();
            }
            if (currentImage < images.Length - 1 && Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Right))
            {
                LeftShift();
            }

            if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Accept))
            {
                if (currentImage < images.Length - 1)
                {
                    LeftShift();
                }
                else
                {
                    Init();
                    Navigator.CallSubmit();
                }
            }
            if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Cancel))
            {
                Init();
                Navigator.CallSubmit();
            }
        }
コード例 #2
0
ファイル: Pause.cs プロジェクト: JonathanHunter/Proceed
        void Update()
        {
            if (Util.GameState.state == Util.GameState.State.EndLevel || Util.GameState.state == Util.GameState.State.Gameover)
            {
                return;
            }
            if (Util.CustomInput.BoolFreshPress(Util.CustomInput.UserInput.Pause))
            {
                if (Util.GameState.state != Util.GameState.State.Paused)
                {
                    Util.GameState.state = Util.GameState.State.Paused;
                    EventSystem.current.SetSelectedGameObject(selected);
                }
                else
                {
                    Util.GameState.state = Util.GameState.State.Playing;
                }

                menu.enabled = Util.GameState.state == Util.GameState.State.Paused;
            }
            if (menu.enabled)
            {
                if (EventSystem.current.currentSelectedGameObject == null)
                {
                    EventSystem.current.SetSelectedGameObject(selected);
                }

                currentSelected = EventSystem.current.currentSelectedGameObject;

                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Up))
                {
                    Navigator.Navigate(Util.CustomInput.UserInput.Up, currentSelected);
                }
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Down))
                {
                    Navigator.Navigate(Util.CustomInput.UserInput.Down, currentSelected);
                }
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Accept))
                {
                    Navigator.CallSubmit();
                }
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Cancel))
                {
                    Resume();
                }
            }
        }
コード例 #3
0
 // Update is called once per frame
 void Update()
 {
     if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadY, PlayerID.One) > 0 ||
         ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickY, PlayerID.One) > ControllerManager.CUSTOM_DEADZONE)
     {
         Navigator.Navigate(Assets.Scripts.Util.Enums.MenuDirections.Up);
     }
     if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadY, PlayerID.One) < 0 ||
         ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickY, PlayerID.One) < -ControllerManager.CUSTOM_DEADZONE)
     {
         Navigator.Navigate(Assets.Scripts.Util.Enums.MenuDirections.Down);
     }
     if (ControllerManager.instance.GetButtonDown(ControllerInputWrapper.Buttons.A, PlayerID.One))
     {
         Navigator.CallSubmit();
     }
 }
コード例 #4
0
        void Update()
        {
            if (menu.enabled)
            {
                if (set)
                {
                    Util.GameState.state = Util.GameState.State.EndLevel;
                    FindObjectOfType <Player.PlayerController>().transform.parent = null;
                    set = false;
                }

                if (!doOnce)
                {
                    timeTotal          = FindObjectOfType <Util.GameState>().time;
                    time               = timeTotal - startTime;
                    lives              = FindObjectOfType <Util.GameState>().lives;
                    timeThisLevel.text = time.ToString("N2") + " sec";
                    total.text         = timeTotal.ToString("N2") + " sec";
                    livesLeft.text     = lives + "";
                    coins.text         = FindObjectOfType <Util.GameState>().currentCoins + " / " + FindObjectOfType <Util.GameState>().currentObtainableCoins;
                    doOnce             = true;
                }

                if (EventSystem.current.currentSelectedGameObject == null)
                {
                    EventSystem.current.SetSelectedGameObject(selected);
                }

                currentSelected = EventSystem.current.currentSelectedGameObject;

                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Left))
                {
                    Navigator.Navigate(Util.CustomInput.UserInput.Left, currentSelected);
                }
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Right))
                {
                    Navigator.Navigate(Util.CustomInput.UserInput.Right, currentSelected);
                }
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Accept))
                {
                    Navigator.CallSubmit();
                }
            }
        }
コード例 #5
0
        void Update()
        {
            if (EventSystem.current.currentSelectedGameObject == button)
            {
                if (currentImage > 0 && Util.CustomInput.BoolFreshPress(Util.CustomInput.UserInput.Left))
                {
                    RightShift();
                }
                if (currentImage < images.Length - 1 && Util.CustomInput.BoolFreshPress(Util.CustomInput.UserInput.Right))
                {
                    LeftShift();
                }

                if (Util.CustomInput.BoolFreshPress(Util.CustomInput.UserInput.Cancel))
                {
                    Init();
                    Navigator.CallSubmit();
                }
            }
        }
コード例 #6
0
        void Update()
        {
            if (Managers.GameState.Instance.State == Util.Enums.GameState.Paused)
            {
                if (EventSystem.current.currentSelectedGameObject == null)
                {
                    EventSystem.current.SetSelectedGameObject(resume);
                }

                currentSelected = EventSystem.current.currentSelectedGameObject;

                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Up))
                {
                    Navigator.Navigate(Util.CustomInput.UserInput.Up, currentSelected);
                }
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Down))
                {
                    Navigator.Navigate(Util.CustomInput.UserInput.Down, currentSelected);
                }
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Accept))
                {
                    Navigator.CallSubmit();
                }
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Cancel) ||
                    Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Pause))
                {
                    EventSystem.current.SetSelectedGameObject(resume);
                    Navigator.CallSubmit();
                }
            }
            else if (!Managers.GameState.Instance.IsPaused)
            {
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Pause))
                {
                    Managers.GameState.Instance.State = Util.Enums.GameState.Paused;
                    EventSystem.current.SetSelectedGameObject(resume);
                    canvas.SetActive(true);
                }
            }
        }
コード例 #7
0
        void Update()
        {
            if (!inInstructions && !inCredits)
            {
                if (Input.GetKey(KeyCode.Escape))
                {
                    Application.Quit();
                }
                if (EventSystem.current.currentSelectedGameObject == null)
                {
                    if (inCredits)
                    {
                        EventSystem.current.SetSelectedGameObject(creditsSelected);
                    }
                    else
                    {
                        EventSystem.current.SetSelectedGameObject(mainSelected);
                    }
                }

                currentSelected = EventSystem.current.currentSelectedGameObject;

                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Up))
                {
                    Navigator.Navigate(Util.CustomInput.UserInput.Up, currentSelected);
                }
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Down))
                {
                    Navigator.Navigate(Util.CustomInput.UserInput.Down, currentSelected);
                }
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Accept))
                {
                    Navigator.CallSubmit();
                }
                if (inCredits && Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Cancel))
                {
                    GoToMain();
                }
            }
        }
コード例 #8
0
        void Update()
        {
            if (EventSystem.current.currentSelectedGameObject == null)
            {
                EventSystem.current.SetSelectedGameObject(backButton);
            }

            currentSelected = EventSystem.current.currentSelectedGameObject;

            if (currentSelected == this.music.gameObject)
            {
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Left))
                {
                    this.music.value -= .2f;
                    Managers.GameState.Instance.MusicVol = this.music.value;
                    Managers.GameState.Instance.bgm.GetComponent <AudioSource>().volume = this.music.value;
                }

                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Right))
                {
                    this.music.value += .2f;
                    Managers.GameState.Instance.MusicVol = this.music.value;
                    Managers.GameState.Instance.bgm.GetComponent <AudioSource>().volume = this.music.value;
                }
            }

            if (currentSelected == this.sfx.gameObject)
            {
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Left))
                {
                    this.sfx.value -= .2f;
                    Managers.GameState.Instance.SFXVolbuffer = this.sfx.value;
                }

                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Right))
                {
                    this.sfx.value += .2f;
                    Managers.GameState.Instance.SFXVolbuffer = this.sfx.value;
                }
            }

            if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Up))
            {
                Navigator.Navigate(Util.CustomInput.UserInput.Up, currentSelected);
            }
            if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Down))
            {
                Navigator.Navigate(Util.CustomInput.UserInput.Down, currentSelected);
            }
            if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Left))
            {
                Navigator.Navigate(Util.CustomInput.UserInput.Left, currentSelected);
            }
            if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Right))
            {
                Navigator.Navigate(Util.CustomInput.UserInput.Right, currentSelected);
            }
            if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Accept))
            {
                Navigator.CallSubmit();
            }
            if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Cancel))
            {
                EventSystem.current.SetSelectedGameObject(backButton);
                Navigator.CallSubmit();
            }
        }
コード例 #9
0
ファイル: MatchSummaryUI.cs プロジェクト: Dattebane/Rangers
    void Update()
    {
        // No axis is being pressed
        if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickX, PlayerID.One) == 0)
        {
            // Reset the timer so that we don't continue scrolling
            hTimer = 0;
        }
        // Horizontal joystick is held right
        // Use > 0.5f so that sensitivity is not too high
        else if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickX, PlayerID.One) > ControllerManager.CUSTOM_DEADZONE)
        {
            // If we can move and it is time to move
            if (hTimer >= delay)
            {
                // Move and reset timer
                Navigator.Navigate(Enums.MenuDirections.Right);
                hTimer = 0;
            }
            hTimer += Time.deltaTime;
        }
        // Horizontal joystick is held left
        // Use > 0.5f so that sensitivity is not too high
        else if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickX, PlayerID.One) < -ControllerManager.CUSTOM_DEADZONE)
        {
            // If we can move and it is time to move
            if (hTimer >= delay)
            {
                // Move and reset timer
                Navigator.Navigate(Enums.MenuDirections.Left);
                hTimer = 0;
            }
            hTimer += Time.deltaTime;
        }

        // No axis is being pressed
        if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickY, PlayerID.One) == 0)
        {
            // Reset the timer so that we don't continue scrolling
            vTimer = 0;
        }
        // Horizontal joystick is held right
        // Use > 0.5f so that sensitivity is not too high
        else if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickY, PlayerID.One) > ControllerManager.CUSTOM_DEADZONE)
        {
            // If we can move and it is time to move
            if (vTimer >= delay)
            {
                // Move and reset timer
                Navigator.Navigate(Enums.MenuDirections.Up);
                vTimer = 0;
            }
            vTimer += Time.deltaTime;
        }
        // Horizontal joystick is held left
        // Use > 0.5f so that sensitivity is not too high
        else if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickY, PlayerID.One) < -ControllerManager.CUSTOM_DEADZONE)
        {
            // If we can move and it is time to move
            if (vTimer >= delay)
            {
                // Move and reset timer
                Navigator.Navigate(Enums.MenuDirections.Down);
                vTimer = 0;
            }
            vTimer += Time.deltaTime;
        }

        // Have dpad functionality so that player can have precise control and joystick quick navigation
        // Check differently for Windows vs OSX

        // No dpad button is pressed
        if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadX, PlayerID.One) == 0 && (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadY, PlayerID.One) == 0))
        {
            dpadPressed = false;
        }
        // Dpad right is pressed; treating as DPADRightOnDown
        if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadX, PlayerID.One) > 0 && !dpadPressed)
        {
            dpadPressed = true;
            Navigator.Navigate(Enums.MenuDirections.Right);
        }
        // Dpad right is pressed; treating as DPADLeftOnDown
        if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadX, PlayerID.One) < 0 && !dpadPressed)
        {
            dpadPressed = true;
            Navigator.Navigate(Enums.MenuDirections.Left);
        }
        // Dpad up is pressed; treating as DPADUpOnDown
        if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadY, PlayerID.One) > 0 && !dpadPressed)
        {
            dpadPressed = true;
            Navigator.Navigate(Enums.MenuDirections.Up);
        }
        // Dpad down is pressed; treating as DPADDownOnDown
        if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadY, PlayerID.One) < 0 && !dpadPressed)
        {
            dpadPressed = true;
            Navigator.Navigate(Enums.MenuDirections.Down);
        }

        if (ControllerManager.instance.GetButtonDown(ControllerInputWrapper.Buttons.A, PlayerID.One))
        {
            Navigator.CallSubmit();
        }
    }
コード例 #10
0
ファイル: GameOver.cs プロジェクト: JonathanHunter/Proceed
        void Update()
        {
            if (menu.enabled)
            {
                if (set)
                {
                    Util.GameState.state = Util.GameState.State.Gameover;
                    FindObjectOfType <Player.PlayerController>().transform.parent = null;
                    set = false;
                }

                if (!doOnce)
                {
                    int   oldLevel  = 0;
                    float oldTime   = 999f;
                    int   oldCoins  = 0;
                    int   oldCoinsT = 999;
                    if (PlayerPrefs.HasKey(hash + "Level"))
                    {
                        oldLevel  = PlayerPrefs.GetInt(hash + "Level");
                        oldTime   = PlayerPrefs.GetFloat(hash + "Time");
                        oldCoins  = PlayerPrefs.GetInt(hash + "Coins");
                        oldCoinsT = PlayerPrefs.GetInt(hash + "CoinsT");
                    }
                    Util.GameState state = FindObjectOfType <Util.GameState>();
                    timeTotal          = state.time;
                    numOfLevels        = state.numOfLevels;
                    coinNum            = state.totalCoins + state.currentCoins;
                    coinTNum           = state.totalObtainableCoins + state.currentObtainableCoins;
                    total.text         = timeTotal.ToString("N2") + " sec";
                    levelsCleared.text = numOfLevels + "";
                    coins.text         = coinNum + " / " + coinTNum;
                    if (numOfLevels > oldLevel || (numOfLevels == oldLevel && ((coinNum / coinTNum) > (oldCoins / oldCoinsT) || timeTotal < oldTime)))
                    {
                        newHigh.SetActive(true);
                        oldHigh.SetActive(false);
                        PlayerPrefs.SetInt(hash + "Level", numOfLevels);
                        PlayerPrefs.SetFloat(hash + "Time", timeTotal);
                        PlayerPrefs.SetInt(hash + "Level", numOfLevels);
                        PlayerPrefs.SetInt(hash + "Level", numOfLevels);
                    }
                    else
                    {
                        newHigh.SetActive(false);
                        oldHigh.SetActive(true);
                        totalHigh.text         = oldTime.ToString("N2") + " sec";
                        levelsClearedHigh.text = oldLevel + "";
                        coinsHigh.text         = oldCoins + " / " + oldCoinsT;
                    }
                    doOnce = true;
                }

                if (EventSystem.current.currentSelectedGameObject == null)
                {
                    EventSystem.current.SetSelectedGameObject(selected);
                }

                currentSelected = EventSystem.current.currentSelectedGameObject;

                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Left))
                {
                    Navigator.Navigate(Util.CustomInput.UserInput.Left, currentSelected);
                }
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Right))
                {
                    Navigator.Navigate(Util.CustomInput.UserInput.Right, currentSelected);
                }
                if (Util.CustomInput.BoolFreshPressDeleteOnRead(Util.CustomInput.UserInput.Accept))
                {
                    Navigator.CallSubmit();
                }
            }
        }
コード例 #11
0
ファイル: PauseUI.cs プロジェクト: Dattebane/Rangers
    // Update is called once per frame
    void Update()
    {
        if (pauseMenuOpen || GameManager.instance.IsPaused)
        {
            transform.GetChild(0).GetComponent <RectTransform>().sizeDelta = Vector2.MoveTowards(transform.GetChild(0).GetComponent <RectTransform>().sizeDelta, new Vector2(871, 275f), Time.deltaTime * (transform.GetChild(0).GetComponent <RectTransform>().sizeDelta.y *10f + 10f));
            if (transform.GetChild(0).GetComponent <RectTransform>().sizeDelta.y > 120)
            {
                pause1.rectTransform.anchoredPosition3D = Vector3.MoveTowards(pause1.rectTransform.anchoredPosition3D, new Vector3(-1.5f, 0, 0), Mathf.Abs(pause1.rectTransform.anchoredPosition3D.x) * Time.deltaTime);
                pause2.rectTransform.anchoredPosition3D = Vector3.MoveTowards(pause2.rectTransform.anchoredPosition3D, new Vector3(1.5f, 0, 0), pause2.rectTransform.anchoredPosition3D.x * Time.deltaTime);
                pause3.rectTransform.anchoredPosition3D = Vector3.MoveTowards(pause3.rectTransform.anchoredPosition3D, Vector3.zero, pause3.rectTransform.anchoredPosition3D.y * Time.deltaTime);
            }
            Navigator.defaultGameObject = startingButton.gameObject;
            if (!EventSystem.current.currentSelectedGameObject)
            {
                EventSystem.current.SetSelectedGameObject(startingButton.gameObject);
            }
            // No axis is being pressed
            if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickX, PlayerID.One) == 0)
            {
                // Reset the timer so that we don't continue scrolling
                hTimer = 0;
            }
            // Horizontal joystick is held right
            // Use > 0.5f so that sensitivity is not too high
            else if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickX, PlayerID.One) > ControllerManager.CUSTOM_DEADZONE)
            {
                // If we can move and it is time to move
                if (hTimer >= delay)
                {
                    // Move and reset timer
                    Navigator.Navigate(Enums.MenuDirections.Right);
                    hTimer = 0;
                }
                hTimer += Time.deltaTime;
            }
            // Horizontal joystick is held left
            // Use > 0.5f so that sensitivity is not too high
            else if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickX, PlayerID.One) < -ControllerManager.CUSTOM_DEADZONE)
            {
                // If we can move and it is time to move
                if (hTimer >= delay)
                {
                    // Move and reset timer
                    Navigator.Navigate(Enums.MenuDirections.Left);
                    hTimer = 0;
                }
                hTimer += Time.deltaTime;
            }

            // No axis is being pressed
            if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickY, PlayerID.One) == 0)
            {
                // Reset the timer so that we don't continue scrolling
                vTimer = 0;
            }
            // Horizontal joystick is held right
            // Use > 0.5f so that sensitivity is not too high
            else if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickY, PlayerID.One) > ControllerManager.CUSTOM_DEADZONE)
            {
                // If we can move and it is time to move
                if (vTimer >= delay)
                {
                    // Move and reset timer
                    Navigator.Navigate(Enums.MenuDirections.Up);
                    vTimer = 0;
                }
                vTimer += Time.deltaTime;
            }
            // Horizontal joystick is held left
            // Use > 0.5f so that sensitivity is not too high
            else if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickY, PlayerID.One) < -ControllerManager.CUSTOM_DEADZONE)
            {
                // If we can move and it is time to move
                if (vTimer >= delay)
                {
                    // Move and reset timer
                    Navigator.Navigate(Enums.MenuDirections.Down);
                    vTimer = 0;
                }
                vTimer += Time.deltaTime;
            }

            // Have dpad functionality so that player can have precise control and joystick quick navigation
            // Check differently for Windows vs OSX

            // No dpad button is pressed
            if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadX, PlayerID.One) == 0 && (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadY, PlayerID.One) == 0))
            {
                dpadPressed = false;
            }
            // Dpad right is pressed; treating as DPADRightOnDown
            if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadX, PlayerID.One) > 0 && !dpadPressed)
            {
                dpadPressed = true;
                Navigator.Navigate(Enums.MenuDirections.Right);
            }
            // Dpad right is pressed; treating as DPADLeftOnDown
            if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadX, PlayerID.One) < 0 && !dpadPressed)
            {
                dpadPressed = true;
                Navigator.Navigate(Enums.MenuDirections.Left);
            }
            // Dpad up is pressed; treating as DPADUpOnDown
            if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadY, PlayerID.One) > 0 && !dpadPressed)
            {
                dpadPressed = true;
                Navigator.Navigate(Enums.MenuDirections.Up);
            }
            // Dpad down is pressed; treating as DPADDownOnDown
            if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadY, PlayerID.One) < 0 && !dpadPressed)
            {
                dpadPressed = true;
                Navigator.Navigate(Enums.MenuDirections.Down);
            }

            if (ControllerManager.instance.GetButtonDown(ControllerInputWrapper.Buttons.A, PlayerID.One))
            {
                Navigator.CallSubmit();
            }
        }
        else
        {
            transform.GetChild(0).GetComponent <RectTransform>().sizeDelta = Vector2.MoveTowards(transform.GetChild(0).GetComponent <RectTransform>().sizeDelta, new Vector2(871, 0f), Time.deltaTime * (650 - transform.GetChild(0).GetComponent <RectTransform>().sizeDelta.y *2f));
            pause1.rectTransform.anchoredPosition3D = Vector3.MoveTowards(pause1.rectTransform.anchoredPosition3D, new Vector3(-500f, 0, 0), Mathf.Abs(pause1.rectTransform.anchoredPosition3D.x * 10f - 1f) * Time.deltaTime);
            pause2.rectTransform.anchoredPosition3D = Vector3.MoveTowards(pause2.rectTransform.anchoredPosition3D, new Vector3(500f, 0, 0), (pause2.rectTransform.anchoredPosition3D.x * 10f + 1f) * Time.deltaTime);
            pause3.rectTransform.anchoredPosition3D = Vector3.MoveTowards(pause3.rectTransform.anchoredPosition3D, new Vector3(0, 200f, 0), (pause3.rectTransform.anchoredPosition3D.y * 10f + 1f) * Time.deltaTime);
        }
    }
コード例 #12
0
    public void Update()
    {
        //Debug.Log(es.currentSelectedGameObject);
        if (CustomInput.BoolFreshPress(CustomInput.UserInput.Pause))
        {
            if (hideBehaviour.OnScreen)
            {
                this.DismissDialog();
            }
            else
            {
                this.BringUpPause();
            }
        }

        if (hideBehaviour.OnScreenPos.position == hideBehaviour.transform.position && hideBehaviour.OnScreen)
        {
            if (CustomInput.BoolFreshPress(CustomInput.UserInput.Cancel))
            {
                this.DismissDialog();
            }
        }

        if (!this.IsMultiplayer)
        {
            if (GameManager.Player1Win)
            {
                this.BringUpWin();
                GameManager.Player1Win = false;
            }
            else if (GameManager.Player1Lose)
            {
                this.BringUpLose();
                GameManager.Player1Lose = false;
            }
        }
        else
        {
            if (GameManager.Player1Win)
            {
                this.BringUpP1Win();
                GameManager.Player1Win = false;
            }
            else if (GameManager.Player1Lose)
            {
                this.BringUpP2Win();
                GameManager.Player1Lose = false;
            }
        }

        if (GameManager.State == Enums.GameStates.Paused)
        {
            if (CustomInput.BoolFreshPress(CustomInput.UserInput.Up))
            {
                Navigator.Navigate(CustomInput.UserInput.Up, CurrentDefault);
            }
            if (CustomInput.BoolFreshPress(CustomInput.UserInput.Down))
            {
                Navigator.Navigate(CustomInput.UserInput.Down, CurrentDefault);
            }
            if (CustomInput.BoolFreshPress(CustomInput.UserInput.Right))
            {
                Navigator.Navigate(CustomInput.UserInput.Right, CurrentDefault);
            }
            if (CustomInput.BoolFreshPress(CustomInput.UserInput.Left))
            {
                Navigator.Navigate(CustomInput.UserInput.Left, CurrentDefault);
            }
            if (CustomInput.BoolFreshPressDeleteOnRead(CustomInput.UserInput.Accept))
            {
                Navigator.CallSubmit();
            }
        }
    }