Ejemplo n.º 1
0
    private static float RemapAxis(GAxis axis, bool down)
    {
        var name = GetControllerName();

        if (name == GInputName.NONE)
        {
            return(0);
        }

        if (axis == GAxis.LEFTHORIZONTAL)
        {
            return(Input.GetAxisRaw("LeftHorizontal" + name.ToString()));
        }
        else if (axis == GAxis.LEFTVERTICAL)
        {
            return(Input.GetAxisRaw("LeftVertical" + name.ToString()));
        }
        else if (axis == GAxis.RIGHTHORIZONTAL)
        {
            return(Input.GetAxisRaw("RightHorizontal" + name.ToString()));
        }
        else if (axis == GAxis.RIGHTVERTICAL)
        {
            return(Input.GetAxisRaw("RightVertical" + name.ToString()));
        }
        else if (axis == GAxis.DHORIZONTAL && (!down || down && previousDHorizontal == 0))
        {
            return(Input.GetAxisRaw("DHorizontal" + name.ToString()));
        }
        else if (axis == GAxis.DVERTICAL && (!down || down && previousDVertical == 0))
        {
            return(Input.GetAxisRaw("DVertical" + name.ToString()));
        }

        return(0);
    }
Ejemplo n.º 2
0
 public static float GetAxisDown(GAxis axis)
 {
     return(RemapAxis(axis, true));
 }
Ejemplo n.º 3
0
 public static float GetAxisRaw(GAxis axis)
 {
     return(RemapAxis(axis, false));
 }