コード例 #1
0
    private void _ActionEvent(WVR_DeviceType deviceType, WVR_InputId id, WVR_EventType eventType)
    {
        GameObject go = _FindGO(deviceType, id);

        if (go == null)
        {
            return;
        }

        switch (eventType)
        {
        case WVR_EventType.WVR_EventType_ButtonPressed:
            PrintDebugLog("_ActionEvent pressdown set color red: " + "deviceType=" + deviceType + ", id= " + (int)id);
            go.GetComponent <Image> ().color = Color.red;
            break;

        case WVR_EventType.WVR_EventType_ButtonUnpressed:
            PrintDebugLog("_ActionEvent pressup set color white: " + "deviceType=" + deviceType + ", id= " + (int)id);
            go.GetComponent <Image> ().color = Color.white;
            break;
        }
    }
コード例 #2
0
    private void OnSwipe(params object[] args)
    {
        WVR_EventType  _event = (WVR_EventType)args [0];
        WVR_DeviceType _type  = (WVR_DeviceType)args [1];

        PrintDebugLog("OnSwipe() _event: " + _event + ", _type: " + _type);

        WaveVR.Device _dev = WaveVR.Instance.getDeviceByType(this.DeviceType);
        if (_dev == null)
        {
            return;
        }
        if (_dev.type != _type)
        {
            return;
        }

        switch (_event)
        {
        case WVR_EventType.WVR_EventType_LeftToRightSwipe:
            transform.Rotate(0, -180 * (10 * Time.deltaTime), 0);
            break;

        case WVR_EventType.WVR_EventType_RightToLeftSwipe:
            transform.Rotate(0, 180 * (10 * Time.deltaTime), 0);
            break;

        case WVR_EventType.WVR_EventType_DownToUpSwipe:
            transform.Rotate(180 * (10 * Time.deltaTime), 0, 0);
            break;

        case WVR_EventType.WVR_EventType_UpToDownSwipe:
            transform.Rotate(-180 * (10 * Time.deltaTime), 0, 0);
            break;
        }
    }