Ejemplo n.º 1
0
    void OnGUI()
    {
        // if there's an analog joystick, output some info
        if (VCAnalogJoystickBase.GetInstance("stick") != null)
        {
            GUI.Label(new Rect(10, 10, 300, 20), "Joystick Axes: " + VCAnalogJoystickBase.GetInstance("stick").AxisX + " " + VCAnalogJoystickBase.GetInstance("stick").AxisY);
        }

        // if there's an a button, output some info
        if (VCButtonBase.GetInstance("A") != null)
        {
            GUI.Label(new Rect(10, 30, 300, 20), "Button Hold (s): " + VCButtonBase.GetInstance("A").HoldTime.ToString());
        }

        // if there's a dpad, output some info
        VCDPadBase dpad = VCDPadBase.GetInstance("dpad");

        if (dpad != null)
        {
            string str = "DPad: ";
            if (dpad.Left)
            {
                str += "Left ";
            }
            if (dpad.Right)
            {
                str += "Right ";
            }
            if (dpad.Up)
            {
                str += "Up ";
            }
            if (dpad.Down)
            {
                str += "Down ";
            }
            if (dpad.Pressed(VCDPadBase.EDirection.None))
            {
                str += "(No Direction)";
            }

            GUI.Label(new Rect(10, 50, 300, 20), str);
        }

        GUI.Label(new Rect(10, 70, 300, 20), "Move cube using controls");
        GUI.Label(new Rect(10, 90, 300, 20), "Double tap joystick / Press A for particles");
    }