コード例 #1
0
ファイル: OVRTouchpad.cs プロジェクト: ealameda/llama-jockey
    // HandleInputMouse
    static void HandleInputMouse(ref Vector3 move)
    {
        if (move.magnitude < minMovMagnitudeMouse)
        {
            OVRMessenger.Broadcast <TouchEvent>("Touchpad", TouchEvent.SingleTap);
        }
        else
        {
            move.Normalize();

            // Left/Right
            if (Mathf.Abs(move.x) > Mathf.Abs(move.y))
            {
                if (move.x > 0.0f)
                {
                    OVRMessenger.Broadcast <TouchEvent>("Touchpad", TouchEvent.Left);
                }
                else
                {
                    OVRMessenger.Broadcast <TouchEvent>("Touchpad", TouchEvent.Right);
                }
            }
            // Up/Down
            else
            if (move.y > 0.0f)
            {
                OVRMessenger.Broadcast <TouchEvent>("Touchpad", TouchEvent.Down);
            }
            else
            {
                OVRMessenger.Broadcast <TouchEvent>("Touchpad", TouchEvent.Up);
            }
        }
    }
コード例 #2
0
ファイル: OVRDevice.cs プロジェクト: MaximKloster/WakeUp
    /// <summary>
    /// We can detect if our devices have been plugged or unplugged, as well as
    /// run things that need to be updated in our game thread
    /// </summary>
    void Update()
    {
        MessageList oldMsgList = MsgList;

        OVR_Update(ref MsgList);

        // HMD SENSOR
        if ((MsgList.isHMDSensorAttached != 0) &&
            (oldMsgList.isHMDSensorAttached == 0))
        {
            OVRMessenger.Broadcast <OVRMainMenu.Device, bool>("Sensor_Attached", OVRMainMenu.Device.HMDSensor, true);
            //Debug.Log("HMD SENSOR ATTACHED");
        }
        else if ((MsgList.isHMDSensorAttached == 0) &&
                 (oldMsgList.isHMDSensorAttached != 0))
        {
            OVRMessenger.Broadcast <OVRMainMenu.Device, bool>("Sensor_Attached", OVRMainMenu.Device.HMDSensor, false);
            //Debug.Log("HMD SENSOR DETACHED");
        }

        // HMD
        if ((MsgList.isHMDAttached != 0) &&
            (oldMsgList.isHMDAttached == 0))
        {
            OVRMessenger.Broadcast <OVRMainMenu.Device, bool>("Sensor_Attached", OVRMainMenu.Device.HMD, true);
            //Debug.Log("HMD ATTACHED");
        }
        else if ((MsgList.isHMDAttached == 0) &&
                 (oldMsgList.isHMDAttached != 0))
        {
            OVRMessenger.Broadcast <OVRMainMenu.Device, bool>("Sensor_Attached", OVRMainMenu.Device.HMD, false);
            //Debug.Log("HMD DETACHED");
        }

        // LATENCY TESTER
        if ((MsgList.isLatencyTesterAttached != 0) &&
            (oldMsgList.isLatencyTesterAttached == 0))
        {
            OVRMessenger.Broadcast <OVRMainMenu.Device, bool>("Sensor_Attached", OVRMainMenu.Device.LatencyTester, true);
            //Debug.Log("LATENCY TESTER ATTACHED");
        }
        else if ((MsgList.isLatencyTesterAttached == 0) &&
                 (oldMsgList.isLatencyTesterAttached != 0))
        {
            OVRMessenger.Broadcast <OVRMainMenu.Device, bool>("Sensor_Attached", OVRMainMenu.Device.LatencyTester, false);
            //Debug.Log("LATENCY TESTER DETACHED");
        }

        // Update prediction if being changed from outside
        PredictionTime = GetPredictionTime();
    }