GetSemanticOf() public static method

public static GetSemanticOf ( VJGamepadButton b ) : string
b VJGamepadButton
return string
Ejemplo n.º 1
0
    // Update is called once per frame
    public void Update()
    {
        float raw_current = 0.0f;

        switch (VJGamePadButtonUtility.GetButtonTypeOf(button))
        {
        case VJGamePadButtonType.Type_Analog:
            float analogInput = Input.GetAxis(VJGamePadButtonUtility.GetSemanticOf(button));
            // trigger goes to -1.0f when released after press.
            if (button == VJGamepadButton.Trigger_L || button == VJGamepadButton.Trigger_R)
            {
                analogInput = Mathf.Max(0.0f, analogInput);
            }
            raw_current = value * boost * analogInput;
            break;

        case VJGamePadButtonType.Type_Digital:
            if (Input.GetKey(VJGamePadButtonUtility.GetKeyCodeOf(button)))
            {
//				if( Input.GetButton(VJGamePadButtonUtility.GetSemanticOf(button)) ) {
                raw_current = value * boost;
            }
            break;
        }

//		if( Input.GetKey(VJGamePadButtonUtility.GetKeyCodeOf(button)) ) {
//			raw_current = value * boost;
//		}
//		if( Input.GetKey(VJGamePadButtonUtility.GetKeyCodeOf(button)) ) {
//			raw_current = value * boost;
//		}

        previous = current;
        current  = raw_current;
        diff     = current - previous;
    }