コード例 #1
0
 public void OnClick()
 {
     if (VvrController.ConnectionState() == VvrConnectionState.Connected)
     {
         VvrController.DisconnectRequest();
     }
     else if (VvrController.ConnectionState() == VvrConnectionState.Disconnected)
     {
         VvrController.ConnectRequest();
     }
 }
コード例 #2
0
    IEnumerator ConnectController()
    {
        GameObject controller = GameObject.Instantiate(controllerPrefab, Vector3.zero, Quaternion.identity);

        controller.name = controllerPrefab.name;
        while (true)
        {
            if (VvrController.ConnectionState() == VvrConnectionState.Connected)
            {
                break;
            }
            yield return(waitForEndOfFrame);
        }
    }
コード例 #3
0
 void Awake()
 {
     if (controllerInstance == null)
     {
         controllerInstance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
     if (instance == null)
     {
         instance = GetComponent <VvrControllerManager>();
         if (instance != null)
         {
             instance.connectionMode        = ConnectionMode;
             instance.maxConnectableDevices = (int)ConnectionStyle;
         }
     }
 }
コード例 #4
0
    // Update is called once per frame
    void Update()
    {
        switch (VvrController.ConnectionState())
        {
        case VvrConnectionState.Connected:
            buttonText.text = "Disconnect";
            break;

        case VvrConnectionState.Connecting:
            buttonText.text = "Connecting";
            break;

        case VvrConnectionState.Disconnecting:
            buttonText.text = "Disconnecting";
            break;

        case VvrConnectionState.Disconnected:
            buttonText.text = "Connect";
            break;

        default:
            break;
        }
    }
コード例 #5
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (VvrController.Recentered() == true)
        {
            target.localRotation = VvrController.Orientation(VvrController.RightHand);
            //target.rotation = Quaternion.identity;
        }
        else
        {
            target.rotation = VvrController.Orientation(VvrController.RightHand);
        }
        //quatText.text = VvrController.Orientation ().ToString ();
        quatText.text = "(" +
                        VvrController.Orientation().x.ToString("f3") + ", " +
                        VvrController.Orientation().y.ToString("f3") + ", " +
                        VvrController.Orientation().z.ToString("f3") + ", " +
                        VvrController.Orientation().w.ToString("f3") + ")";

        Vector3 gyro = VvrController.Gyro();

        gyroText.text = "Gyro: (" +
                        gyro.x.ToString("f2") + ", " +
                        gyro.y.ToString("f2") + ", " +
                        gyro.z.ToString("f2") + ")";

        Vector3 accel = VvrController.Accel();

        accelText.text = "Accel: (" +
                         accel.x.ToString("f2") + ", " +
                         accel.y.ToString("f2") + ", " +
                         accel.z.ToString("f2") + ")";

        joystickText.text = "Joystick: (" +
                            VvrController.Joystick().x.ToString("f2") + ", " +
                            VvrController.Joystick().y.ToString("f2") + ")";

        padText.text = "Action: " + VvrController.JoystickAction().ToString();

        appBtnText.text = "App: " + VvrController.AppButton().ToString();

        string recenter = null;

        if (VvrController.Recentering())
        {
            recenter = "(Recentering)";
        }
        else if (VvrController.Recentered())
        {
            recenter = "(Recentered)";
        }
        homeBtnText.text = "Home: " + VvrController.HomeButton().ToString() + " " + recenter;

        clickText.text = "Click: " + VvrController.ClickButton().ToString();

        triggerText.text = "Trigger: " + VvrController.Trigger().ToString();

        volumeText.text = "Volume: " + VvrController.Volume().ToString();

        deviceStatusText.text = "DeviceStatus: " +
                                VvrController.ConnectionState().ToString();

        batteryLevelText.text = "Battery: " + VvrController.BatteryLevel().ToString();

        deviceInformationText.text = "Manufacturer:[" + VvrController.ManufacturerName() + "]\n" +
                                     "Model:[" + VvrController.ModelNumber() + "] Serial:[" + VvrController.SerialNumber() + "]\n" +
                                     "HW Rev.:[" + VvrController.HardwareRevision() + "] SW Rev.:[" + VvrController.SoftwareRevision() +
                                     "] FW Rev.:[" + VvrController.FirmwareRevision() + "]";
    }