Esempio n. 1
0
        public SinglePlayerInputs GetInputs()
        {
#if REWIRED
            return(InputReaderRewired.GetInputs(_p1));
#endif
            short direction           = 5;
            SinglePlayerInputs inputs = new SinglePlayerInputs();
            float h;
            float v;

            if (_p1)
            {
                //if(P1_Joystick)
                {
                    h = UnityEngine.Input.GetAxisRaw("Horizontal_PsStick1") + UnityEngine.Input.GetAxisRaw("Horizontal_KB1");;
                    v = UnityEngine.Input.GetAxisRaw("Vertical_PsStick1") + UnityEngine.Input.GetAxisRaw("Vertical_KB1");
                }
                //else
                //{
                //    h = UnityEngine.Input.GetAxis("Horizontal_KB1");
                //    v = UnityEngine.Input.GetAxis("Vertical_KB1");
                //}
                inputs.A     = UnityEngine.Input.GetButton("A_P1");
                inputs.B     = UnityEngine.Input.GetButton("B_P1");
                inputs.C     = UnityEngine.Input.GetButton("C_P1");
                inputs.Start = UnityEngine.Input.GetButtonDown("Start_P1");
            }
            else
            {
                //if (P2_Joystick)
                {
                    h = UnityEngine.Input.GetAxisRaw("Horizontal_PsStick2") + UnityEngine.Input.GetAxisRaw("Horizontal_KB2");
                    v = UnityEngine.Input.GetAxisRaw("Vertical_PsStick2") + UnityEngine.Input.GetAxisRaw("Vertical_KB2");
                }
                //else
                //{
                //    h = UnityEngine.Input.GetAxis("Horizontal_KB2");
                //    v = UnityEngine.Input.GetAxis("Vertical_KB2");
                //}
                inputs.A     = UnityEngine.Input.GetButton("A_P2");
                inputs.B     = UnityEngine.Input.GetButton("B_P2");
                inputs.C     = UnityEngine.Input.GetButton("C_P2");
                inputs.Start = UnityEngine.Input.GetButtonDown("Start_P2");
            }
            if (h > 0.1)
            {
                if (v > 0.1)
                {
                    if (_p1)
                    {
                        direction = 9;
                    }
                    else
                    {
                        direction = 7;
                    }
                }
                else if (v < -0.1)
                {
                    if (_p1)
                    {
                        direction = 3;
                    }
                    else
                    {
                        direction = 1;
                    }
                }
                else
                {
                    if (_p1)
                    {
                        direction = 6;
                    }
                    else
                    {
                        direction = 4;
                    }
                }
            }
            else if (h < -0.1)
            {
                if (v > 0.1)
                {
                    if (_p1)
                    {
                        direction = 7;
                    }
                    else
                    {
                        direction = 9;
                    }
                }
                else if (v < -0.1)
                {
                    if (_p1)
                    {
                        direction = 1;
                    }
                    else
                    {
                        direction = 3;
                    }
                }
                else
                {
                    if (_p1)
                    {
                        direction = 4;
                    }
                    else
                    {
                        direction = 6;
                    }
                }
            }
            else
            {
                if (v > 0.1)
                {
                    if (_p1)
                    {
                        direction = 8;
                    }
                    else
                    {
                        direction = 8;
                    }
                }
                else if (v < -0.1)
                {
                    if (_p1)
                    {
                        direction = 2;
                    }
                    else
                    {
                        direction = 2;
                    }
                }
                else
                {
                    direction = 5;
                }
            }
            inputs.JoystickDirection = direction;
            return(inputs);
        }
Esempio n. 2
0
    private SinglePlayerInputs GetInputs(bool _p1)
    {
        return(Assets.Input.InputSources.InputSourceManager.GetInputs(_p1));

        //rewired hidden by inputsourcemanager now to allow AI and netplay
        return(InputReaderRewired.GetInputs(_p1));

        //not rewired version, default unity input binding
        short direction           = 5;
        SinglePlayerInputs inputs = new SinglePlayerInputs();
        float h;
        float v;

        if (_p1)
        {
            //if(P1_Joystick)
            {
                h = Input.GetAxisRaw("Horizontal_PsStick1") + Input.GetAxisRaw("Horizontal_KB1");;
                v = Input.GetAxisRaw("Vertical_PsStick1") + Input.GetAxisRaw("Vertical_KB1");
            }
            //else
            //{
            //    h = Input.GetAxis("Horizontal_KB1");
            //    v = Input.GetAxis("Vertical_KB1");
            //}
            inputs.A     = Input.GetButton("A_P1");
            inputs.B     = Input.GetButton("B_P1");
            inputs.C     = Input.GetButton("C_P1");
            inputs.Start = Input.GetButtonDown("Start_P1");
        }
        else
        {
            //if (P2_Joystick)
            {
                h = Input.GetAxisRaw("Horizontal_PsStick2") + Input.GetAxisRaw("Horizontal_KB2");
                v = Input.GetAxisRaw("Vertical_PsStick2") + Input.GetAxisRaw("Vertical_KB2");
            }
            //else
            //{
            //    h = Input.GetAxis("Horizontal_KB2");
            //    v = Input.GetAxis("Vertical_KB2");
            //}
            inputs.A     = Input.GetButton("A_P2");
            inputs.B     = Input.GetButton("B_P2");
            inputs.C     = Input.GetButton("C_P2");
            inputs.Start = Input.GetButtonDown("Start_P2");
        }
        if (h > 0.1)
        {
            if (v > 0.1)
            {
                if (_p1)
                {
                    direction = 9;
                }
                else
                {
                    direction = 7;
                }
            }
            else if (v < -0.1)
            {
                if (_p1)
                {
                    direction = 3;
                }
                else
                {
                    direction = 1;
                }
            }
            else
            {
                if (_p1)
                {
                    direction = 6;
                }
                else
                {
                    direction = 4;
                }
            }
        }
        else if (h < -0.1)
        {
            if (v > 0.1)
            {
                if (_p1)
                {
                    direction = 7;
                }
                else
                {
                    direction = 9;
                }
            }
            else if (v < -0.1)
            {
                if (_p1)
                {
                    direction = 1;
                }
                else
                {
                    direction = 3;
                }
            }
            else
            {
                if (_p1)
                {
                    direction = 4;
                }
                else
                {
                    direction = 6;
                }
            }
        }
        else
        {
            if (v > 0.1)
            {
                if (_p1)
                {
                    direction = 8;
                }
                else
                {
                    direction = 8;
                }
            }
            else if (v < -0.1)
            {
                if (_p1)
                {
                    direction = 2;
                }
                else
                {
                    direction = 2;
                }
            }
            else
            {
                direction = 5;
            }
        }
        inputs.JoystickDirection = direction;
        return(inputs);
    }
Esempio n. 3
0
 public SinglePlayerInputs GetInputs()
 {
      return InputReaderRewired.GetInputs(_p1);
 }