Exemplo n.º 1
0
        private float AxisCheck(string controlname, bool getRawValue = false)
        {
            Sinput.SinputUpdate();

            float returnV = 0f;
            float v       = 0f;

            for (int i = 0; i < joystickIndeces.Count; i++)
            {
                if (!getRawValue)
                {
                    v = Sinput.GetAxis(controlname, (InputDeviceSlot)joystickIndeces[i]);
                }
                else
                {
                    v = Sinput.GetAxisRaw(controlname, (InputDeviceSlot)joystickIndeces[i]);
                }
                if (Mathf.Abs(v) > Mathf.Abs(returnV))
                {
                    returnV = v;
                }
            }


            return(returnV);
        }
Exemplo n.º 2
0
        private bool ButtonCheck(string controlname, ButtonAction bAction)
        {
            Sinput.SinputUpdate();

            for (int i = 0; i < joystickIndeces.Count; i++)
            {
                if (bAction == ButtonAction.DOWN && Sinput.GetButtonDown(controlname, (InputDeviceSlot)joystickIndeces[i]))
                {
                    return(true);
                }
                if (bAction == ButtonAction.HELD && Sinput.GetButton(controlname, (InputDeviceSlot)joystickIndeces[i]))
                {
                    return(true);
                }
                if (bAction == ButtonAction.UP && Sinput.GetButtonUp(controlname, (InputDeviceSlot)joystickIndeces[i]))
                {
                    return(true);
                }
                if (bAction == ButtonAction.REPEATING && Sinput.GetButtonDownRepeating(controlname, (InputDeviceSlot)joystickIndeces[i]))
                {
                    return(true);
                }
            }


            return(false);
        }
Exemplo n.º 3
0
 public static void SetVirtualAxis(string virtualInputName, float newAxisValue)
 {
     Sinput.SinputUpdate();             //make sure sinput is set up, so any bound virtual inputs have been instantiated
     for (int i = 0; i < inputs.Count; i++)
     {
         if (inputs[i].name == virtualInputName)
         {
             inputs[i].SetAxisValue(newAxisValue);
             return;
         }
     }
     Debug.Log("Virtual input \"" + virtualInputName + "\" not found.");
 }
Exemplo n.º 4
0
 public static void SetVirtualButtonHeld(string virtualInputName, bool held)
 {
     Sinput.SinputUpdate();             //make sure sinput is set up, so any bound virtual inputs have been instantiated
     for (int i = 0; i < inputs.Count; i++)
     {
         if (inputs[i].name == virtualInputName)
         {
             inputs[i].UpdateButtonState(held);
             return;
         }
     }
     Debug.Log("Virtual input \"" + virtualInputName + "\" not found.");
 }
Exemplo n.º 5
0
 public static void SetDeltaPreference(string virtualInputName, bool preferFrameDelta)
 {
     Sinput.SinputUpdate();             //make sure sinput is set up, so any bound virtual inputs have been instantiated
     for (int i = 0; i < inputs.Count; i++)
     {
         if (inputs[i].name == virtualInputName)
         {
             inputs[i].preferDeltaUse = preferFrameDelta;
             return;
         }
     }
     Debug.Log("Virtual input \"" + virtualInputName + "\" not found.");
 }