Ejemplo n.º 1
0
 public static OmicronController.ButtonState GetButtonState(int wandID, CAVE2.Button button)
 {
     return(CAVE2Manager.GetButtonState(wandID, button));
 }
    // Update is called once per frame
    void Update()
    {
        leftAnalogStick  = new Vector2(CAVE2Manager.GetAxis(wandID, CAVE2Manager.Axis.LeftAnalogStickLR), CAVE2Manager.GetAxis(wandID, CAVE2Manager.Axis.LeftAnalogStickUD));
        rightAnalogStick = new Vector2(CAVE2Manager.GetAxis(wandID, CAVE2Manager.Axis.RightAnalogStickLR), CAVE2Manager.GetAxis(wandID, CAVE2Manager.Axis.RightAnalogStickUD));
        analogTriggers   = new Vector2(CAVE2Manager.GetAxis(wandID, CAVE2Manager.Axis.AnalogTriggerL), CAVE2Manager.GetAxis(wandID, CAVE2Manager.Axis.AnalogTriggerR));

        if (buttonL3)
        {
            buttonL3.transform.localEulerAngles = new Vector3(leftAnalogStick.y, 0, -leftAnalogStick.x) * 30;
        }
        if (buttonR3)
        {
            buttonR3.transform.localEulerAngles = new Vector3(rightAnalogStick.y, 0, -rightAnalogStick.x) * 30;
        }

        if (buttonL2)
        {
            buttonL2.transform.localEulerAngles = new Vector3(0, 90, analogTriggers.x * 20);
        }
        if (buttonR2)
        {
            buttonR2.transform.localEulerAngles = new Vector3(0, 90, analogTriggers.y * 20);
        }

        // Tests if hold state is working properly (public state varibles should change)
        cross    = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.Button3);
        circle   = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.Button2);
        triangle = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.Button1);
        square   = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.Button4);

        up    = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.ButtonUp);
        down  = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.ButtonDown);
        left  = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.ButtonLeft);
        right = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.ButtonRight);

        L1 = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.Button5);
        L2 = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.Button7);
        L3 = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.Button6);

        R1 = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.Button8);
        //R2 = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.Button9);
        R3 = CAVE2Manager.GetButtonState(wandID, CAVE2Manager.Button.Button9);

        // Tests if up/down is working (visual buttons should change)
        CheckButtonState((int)CAVE2Manager.Button.Button3, cross);
        CheckButtonState((int)CAVE2Manager.Button.Button2, circle);
        CheckButtonState((int)CAVE2Manager.Button.Button1, triangle);
        CheckButtonState((int)CAVE2Manager.Button.Button4, square);

        CheckButtonState((int)CAVE2Manager.Button.ButtonUp, up);
        CheckButtonState((int)CAVE2Manager.Button.ButtonDown, down);
        CheckButtonState((int)CAVE2Manager.Button.ButtonLeft, left);
        CheckButtonState((int)CAVE2Manager.Button.ButtonRight, right);

        CheckButtonState((int)CAVE2Manager.Button.Button5, L1);
        CheckButtonState((int)CAVE2Manager.Button.Button7, L2);
        CheckButtonState((int)CAVE2Manager.Button.Button6, L3);

        CheckButtonState((int)CAVE2Manager.Button.Button8, R1);
        //CheckButtonState((int)CAVE2Manager.Button.Button9, R2);
        CheckButtonState((int)CAVE2Manager.Button.Button9, R3);
    }