Esempio n. 1
0
    /*
     * / Returns input of specific player
     */
    void playerInput(int playNum)
    {
#if WindowsBuild
        _Controller = Gen_ControllerManager.Instance.GetController(playNum);
        if (_Controller.IsConnected)
        {
            _LeftStickX  = _Controller.GetStick_L().X;
            _LeftStickY  = _Controller.GetStick_L().Y;
            _RightStickX = _Controller.GetStick_R().X;
            _RightStickY = _Controller.GetStick_R().Y;
        }
#else
        _LeftStickX  = Input.GetAxis("LeftStickX" + playNum.ToString());
        _LeftStickY  = Input.GetAxis("LeftStickY" + playNum.ToString());
        _RightStickX = Input.GetAxis("RightStickX" + playNum.ToString());
        _RightStickY = Input.GetAxis("RightStickY" + playNum.ToString());
#endif
    }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
#if WindowsBuild
        _Controller = Gen_ControllerManager.Instance.GetController(1);
        if (_Controller.IsConnected)
        {
            _LeftStickX = _Controller.GetStick_L().X;
        }
#else
        _LeftStickX = Input.GetAxis("LeftStickX1");
#endif
        if (_LeftStickX == 0.0f && _Moved)
        {
            _Moved = false;
        }

        if ((_LeftStickX > 0.5f || _LeftStickX < -0.5f) && !_Moved)
        {
            _Moved = true;
            ChangeSelected();
        }

#if WindowsBuild
        if (_Controller.IsConnected)
        {
            if (_Controller.GetButtonDown("A"))
            {
                ClickSelected();
            }
        }
#else
        if (Input.GetButtonDown("Ready1"))
        {
            ClickSelected();
        }
#endif
    }
Esempio n. 3
0
    void Update()
    {
        pausedPlayer = _PauseScript._PausedPlayer;
        //Debug.Log(pausedPlayer);
#if WindowsBuild
        if (pausedPlayer == 0)
        {
            _Controller = Gen_ControllerManager.Instance.GetController(1);
        }
        else
        {
            _Controller = Gen_ControllerManager.Instance.GetController(pausedPlayer);
        }
        // Debug.Log(_Controller.Index);
        if (_Controller.IsConnected)
        {
            _LeftStickY = _Controller.GetStick_L().Y;
        }
#else
        if (Time.timeScale == 0)
        {
            _LeftStickY = Input.GetAxis("LeftStickY" + pausedPlayer.ToString());
        }
#endif

        if ((_LeftStickY == 0.0f))
        {
            flag = true;
        }

        if (_LeftStickY >= .75f && flag)
        {
            flag = false;
            Cycle(false);
        }
        if (_LeftStickY <= -.75f && flag)
        {
            flag = false;
            Cycle(true);
        }

        //Debug.Log(_LeftStickY);
        //Debug.Log(_Counter);
#if WindowsBuild
        if (Time.timeScale == 0)
        {
            if (_Controller.IsConnected)
            {
                ButtonArray[_Counter].GetComponent <Button>().Select();

                if (_Controller.GetButtonDown("A"))
                {
                    switch (_Counter)
                    {
                    case 0:
                        Restart();
                        break;

                    case 1:
                        MainMenu();
                        break;

                    case 2:
                        Quit();
                        break;
                    }
                }
            }
        }
        else if (Time.timeScale == 1.0f)
        {
            _Counter = 0;
        }
#else
        if (Time.timeScale == 0)
        {
            //if (ButtonArray[_Counter].GetComponent<Button>().IsActive())
            //Debug.Log(_Counter);
            //Debug.Log(ButtonArray[_Counter].GetComponent<Button>().IsActive());

            ButtonArray[_Counter].GetComponent <Button>().Select();

            //Debug.Log(_Counter);
            if (Input.GetButtonDown("Ready" + pausedPlayer.ToString()))
            {
                switch (_Counter)
                {
                case 0:
                    Restart();
                    break;

                case 1:
                    MainMenu();
                    break;

                case 2:
                    Quit();
                    break;
                }
            }
        }
        else if (Time.timeScale == 1.0f)
        {
            _Counter = 0;
        }
#endif



        //if (_PauseScript._Pause)
        //_Counter = 0;
    }
Esempio n. 4
0
    void Update()
    {
#if WindowsBuild
        if (_Controller.IsConnected)
        {
            if (!_BackZone)
            {
                _LeftStickY = _Controller.GetStick_L().Y;
            }
        }
#else
        if (!_BackZone)
        {
            _LeftStickY = Input.GetAxis("LeftStickY1");
        }
#endif
        if ((_LeftStickY == 0.0f))
        {
            flag = true;
        }

        if (_LeftStickY >= .75f && flag)
        {
            flag = false;
            Cycle(false);
        }
        if (_LeftStickY <= -.75f && flag)
        {
            flag = false;
            Cycle(true);
        }

        //Debug.Log(_LeftStickY);
        //Debug.Log(_Counter);

#if WindowsBuild
        if (_Controller.IsConnected)
        {
            if (_Controller.GetButtonDown("A"))
            {
                switch (_Counter)
                {
                case 0:
                    LevelPlaySelect();
                    break;

                case 1:
                    Controls();
                    break;

                case 2:
                    Quit();
                    break;

                case 3:
                    Back();
                    break;
                }
            }
        }
#else
        if (Input.GetButtonDown("Ready1"))
        {
            switch (_Counter)
            {
            case 0:
                LevelPlaySelect();
                break;

            case 1:
                Controls();
                break;

            case 2:
                Quit();
                break;

            case 3:
                Back();
                break;
            }
        }
#endif

        //Select buttons
        if (_ButtonArray[_Counter] != null)
        {
            _ButtonArray[_Counter].GetComponent <Button>().Select();
        }
    }