Example #1
0
    public void SetControllerModel(WaveVR_Controller.EDeviceType type, GameObject model)
    {
        PrintDebugLog("SetControllerModel() type: " + type + ", Model: " + (model != null ? model.name : "null"));
        bool found = false;

        for (int i = 0; i < ControllerModels.Count; i++)
        {
            if (ControllerModels [i].DeviceType == type)
            {
                if (ControllerModels [i].Model != null)
                {
                    ControllerModels [i].Model.SetActive(false);
                }

                ControllerModels [i].Model = model;
                ControllerModels [i].Model.SetActive(true);
                found = true;
                break;
            }
        }
        if (!found)
        {
            ControllerModels.Add(new ControllerModel(type, model));
        }
    }
    public bool GetInputMappingPair(WaveVR_Controller.EDeviceType device, ref WVR_InputId destination)
    {
        if (!WaveVR.Instance.Initialized)
        {
            return(false);
        }

        // Default true in editor mode, destination will be equivallent to source.
        bool _result = true;

        WVR_DeviceType _type = WaveVR_Controller.Input(device).DeviceType;

        /*
         *      uint _ret = Interop.WVR_GetInputMappingTable (_type, this.inputTable, WaveVR_ButtonList.inputTableSize);
         *      for (int _i = 0; _i < (int)_ret; _i++)
         *      {
         *              PrintDebugLog ("GetInputMappingPair " + device + " table: " + _type + " " + this.inputTable [_i].source.id + " to " + inputTable [_i].destination.id);
         *              if (this.inputTable [_i].destination.id == destination)
         *              {
         *                      destination = this.inputTable [_i].source.id;
         *                      _result = true;
         *                      break;
         *              }
         *      }
         */
        _result = Interop.WVR_GetInputMappingPair(_type, destination, ref this.inputPair);
        if (_result)
        {
            destination = this.inputPair.source.id;
        }

        return(_result);
    }
Example #3
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        WaveVR_Controller.EDeviceType type = eventData.enterEventCamera.gameObject.GetComponent <WaveVR_PoseTrackerManager>().Type;
        GameObject target = eventData.enterEventCamera.gameObject;

        if (target.GetComponent <WaveVR_PoseTrackerManager>())
        {
            if (type == WaveVR_Controller.EDeviceType.NonDominant)
            {
                m_LeftController    = target;
                isControllerFocus_L = true;
            }

            // Right-Hand mode
            if (!WaveVR_Controller.IsLeftHanded)
            {
                GetComponent <MeshRenderer>().material.SetColor("_Color", Color.blue);
            }

            // Left-Hand mode
            else if (WaveVR_Controller.IsLeftHanded)
            {
                GetComponent <MeshRenderer>().material.SetColor("_Color", Color.red);
            }
        }
        NonFocusControllerType = type;
    }
Example #4
0
 public void SetControllerBeamLength(WaveVR_Controller.EDeviceType dt, float length)
 {
     if (this.controllerInputModule != null)
     {
         this.controllerInputModule.ChangeBeamLength(dt, length);
     }
 }
    void onAdaptiveControllerModelReady(params object[] args)
    {
        WaveVR_Controller.EDeviceType device = (WaveVR_Controller.EDeviceType)args[0];

        if (device == this.device)
        {
            CollectEffectObjects();
        }
    }
    void onAdaptiveControllerModelReady(params object[] args)
    {
#if UNITY_EDITOR
        if (Application.isPlaying)
        {
            return;
        }
#endif
        WaveVR_Controller.EDeviceType _device = (WaveVR_Controller.EDeviceType)args[0];

        if (this.deviceType == _device)
        {
            WaveVR_RenderModel wrm = this.GetComponentInChildren <WaveVR_RenderModel>();

            if (wrm != null)
            {
                GameObject modelObj = wrm.gameObject;

                int modelchild = modelObj.transform.childCount;
                PrintDebugLog("onAdaptiveControllerModelReady() model child: " + modelchild);
                for (int j = 0; j < modelchild; j++)
                {
                    GameObject childName = modelObj.transform.GetChild(j).gameObject;
                    if (childName.name == "__CM__Emitter" || childName.name == "_[CM]_Emitter")
                    {
                        emitter = childName;
                        PrintDebugLog("emitter local position (" + emitter.transform.localPosition.x + ", " + emitter.transform.localPosition.y + ", " + emitter.transform.localPosition.z + ")");
                        PrintDebugLog("emitter local EulerAngles " + emitter.transform.localEulerAngles);

                        if (moveToEmitter != null)
                        {
                            PrintDebugLog("__CM__Emitter is found, update objects' parent");

                            foreach (GameObject mgo in moveToEmitter)
                            {
                                if (mgo != null)
                                {
                                    PrintDebugLog("Move " + mgo.name + " to be children of emitter");
                                    mgo.transform.parent        = emitter.transform;
                                    mgo.transform.localRotation = Quaternion.identity;
                                    mgo.transform.localPosition = Vector3.zero;
                                    mgo.SetActive(false);
                                    mgo.SetActive(true);
                                }
                            }
                        }

                        break;
                    }
                }
            }
            else
            {
                PrintDebugLog("WaveVR_RenderModel is not found");
            }
        }
    }
 public WaveVR_RaycastResult GetRaycastResult(WaveVR_Controller.EDeviceType device)
 {
     for (int i = 0; i < RaycastResults.Count; i++)
     {
         if (RaycastResults [i].Type == device)
         {
             return(RaycastResults [i].Result);
         }
     }
     return(null);
 }
Example #8
0
 public GameObject GetControllerModel(WaveVR_Controller.EDeviceType type)
 {
     for (int i = 0; i < ControllerModels.Count; i++)
     {
         if (ControllerModels [i].DeviceType == type)
         {
             return(ControllerModels [i].Model);
         }
     }
     return(null);
 }
Example #9
0
 public bool HasControllerLoader(WaveVR_Controller.EDeviceType type)
 {
     for (int i = 0; i < ControllerModels.Count; i++)
     {
         if (ControllerModels [i].DeviceType == type)
         {
             return(ControllerModels [i].HasLoader);
         }
     }
     return(false);
 }
Example #10
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        WaveVR_Controller.EDeviceType type = WaveVR_Controller.EDeviceType.NonDominant;
        //eventData.enterEventCamera.gameObject.GetComponent<WaveVR_PoseTrackerManager>().Type;
        GameObject target = eventData.enterEventCamera.gameObject;

        if (target.GetComponent <WaveVR_PoseTrackerManager>())
        {
            //if (type == WaveVR_Controller.EDeviceType.Dominant)
            //{
            //    m_RightController = target;
            //    isControllerFocus_R = true;
            //}
            //else
            if (type == WaveVR_Controller.EDeviceType.NonDominant)
            {
                m_LeftController    = eventData.enterEventCamera.gameObject;
                isControllerFocus_L = true;
            }

            if (WaveVR_Controller.Input(curFocusControllerType).GetPressDown(WVR_InputId.WVR_InputId_Alias1_Trigger))
            {
                dragging = false;

                Vector3 fwd_L = m_LeftController.transform.TransformDirection(Vector3.forward);
                Ray     ray   = new Ray(WaveVR_Controller.Input(curFocusControllerType).transform.pos, fwd_L);
                //var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                if (GetComponent <Collider>().Raycast(ray, out hit, Mathf.Infinity))
                {
                    dragging = true;
                }
            }
            if (WaveVR_Controller.Input(curFocusControllerType).GetPressUp(WVR_InputId.WVR_InputId_Alias1_Trigger))
            {
                dragging = false;
            }
            if (dragging && WaveVR_Controller.Input(curFocusControllerType).GetPress(WVR_InputId.WVR_InputId_Alias1_Trigger))
            {
                Vector3 fwd_L = m_LeftController.transform.TransformDirection(Vector3.forward);
                Ray     ray   = new Ray(WaveVR_Controller.Input(curFocusControllerType).transform.pos, fwd_L);
                //var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                if (GetComponent <Collider>().Raycast(ray, out hit, Mathf.Infinity))
                {
                    var point = hit.point;
                    point = GetComponent <Collider>().ClosestPointOnBounds(point);
                    SetThumbPosition(point);
                    SendMessage("OnDrag", Vector3.one - (thumb.position - GetComponent <Collider>().bounds.min) / GetComponent <Collider>().bounds.size.x);
                }
            }
        }
        curFocusControllerType = type;
    }
 public void SetRaycastResult(WaveVR_Controller.EDeviceType device, GameObject gameObject, Vector3 worldPosition)
 {
     for (int i = 0; i < RaycastResults.Count; i++)
     {
         if (RaycastResults [i].Type == device)
         {
             RaycastResults [i].Result.gameObject    = gameObject;
             RaycastResults [i].Result.worldPosition = worldPosition;
             break;
         }
     }
 }
Example #12
0
 public void MarkControllerLoader(WaveVR_Controller.EDeviceType type, bool value)
 {
     PrintDebugLog(type + " " + (value ? "has" : "doesn't have") + " ControllerLoader.");
     for (int i = 0; i < ControllerModels.Count; i++)
     {
         if (ControllerModels [i].DeviceType == type)
         {
             ControllerModels [i].HasLoader = value;
             return;
         }
     }
 }
    public bool GetInputMappingPair(WaveVR_Controller.EDeviceType device, ref WaveVR_ButtonList.EButtons destination)
    {
        WVR_InputId id = (WVR_InputId)destination;

        bool ret = GetInputMappingPair(device, ref id);

        if (ret)
        {
            destination = GetEButtonsType(id);
        }

        return(ret);
    }
    public bool GetInputMappingPair(WaveVR_Controller.EDeviceType device, ref EButtons destination)
    {
        bool        _result = false;
        WVR_InputId _wbtn   = (WVR_InputId)destination;

        _result = GetInputMappingPair(device, ref _wbtn);
        if (_result)
        {
            destination = GetEButtonsType(_wbtn);
        }

        return(_result);
    }
 public void SetControllerModel(WaveVR_Controller.EDeviceType type, GameObject model)
 {
     PrintDebugLog("SetControllerModel() type: " + type + ", model: " + (model != null ? model.name : "null"));
     if (((ControllerModel)ControllerModels [type]).model != null)
     {
         ((ControllerModel)ControllerModels [type]).model.SetActive(false);
     }
     ((ControllerModel)ControllerModels [type]).model = model;
     if (((ControllerModel)ControllerModels [type]).model != null)
     {
         ((ControllerModel)ControllerModels [type]).model.SetActive(true);
     }
 }
    void OnEnable()
    {
        PrintDebugLog("OnEnable");
        sessionid = 0;

        if (WhichHand == ControllerHand.Controller_Right)
        {
            deviceType = WaveVR_Controller.EDeviceType.Dominant;
        }
        else
        {
            deviceType = WaveVR_Controller.EDeviceType.NonDominant;
        }

        connected = checkConnection();

        if (connected)
        {
            WaveVR.Device _device = WaveVR.Instance.getDeviceByType(this.deviceType);
            if (!checkChild())
            {
                if (isProcessing)
                {
                    PrintDebugLog("OnEnable - Controller connected, model is loading!");
                }
                else
                {
                    PrintDebugLog("Controller load when OnEnable!");
                    onLoadController(_device.type);
                }
            }
            else
            {
                if (isRenderModelNameSameAsPrevious())
                {
                    PrintDebugLog("OnEnable - Controller connected, model was loaded!");
                }
                else
                {
                    PrintDebugLog("Controller load when OnEnable, render model is different!");
                    deleteChild();
                    onLoadController(_device.type);
                }
            }
        }
#if !UNITY_EDITOR
        WaveVR_Utils.Event.Listen(WaveVR_Utils.Event.DEVICE_CONNECTED, onDeviceConnected);
        WaveVR_Utils.Event.Listen(WaveVR_Utils.Event.DEVICE_ROLE_CHANGED, onDeviceRoleChanged);
        WaveVR_Utils.Event.Listen(WaveVR_Utils.Event.OEM_CONFIG_CHANGED, onOEMConfigChanged);
#endif
    }
 void OnControllerLoaded(params object[] args)
 {
     WaveVR_Controller.EDeviceType _type = (WaveVR_Controller.EDeviceType)args [0];
     if (_type == WaveVR_Controller.EDeviceType.Dominant)
     {
         this.dominantController = (GameObject)args [1];
         Log.d(LOG_TAG, "OnControllerLoaded() dominant: " + this.dominantController.name);
     }
     if (_type == WaveVR_Controller.EDeviceType.NonDominant)
     {
         this.nonDominantController = (GameObject)args [1];
         Log.d(LOG_TAG, "OnControllerLoaded() nondominant: " + this.nonDominantController.name);
     }
 }
    private void setupButtonAttributes(WaveVR_Controller.EDeviceType device, List <WaveVR_ButtonList.EButtons> buttons, WVR_InputAttribute_t[] inputAttributes, int count)
    {
        WVR_DeviceType dev_type = WaveVR_Controller.Input(device).DeviceType;

        for (int i = 0; i < count; i++)
        {
            switch (buttons[i])
            {
            case WaveVR_ButtonList.EButtons.Menu:
            case WaveVR_ButtonList.EButtons.Grip:
            case WaveVR_ButtonList.EButtons.DPadLeft:
            case WaveVR_ButtonList.EButtons.DPadUp:
            case WaveVR_ButtonList.EButtons.DPadRight:
            case WaveVR_ButtonList.EButtons.DPadDown:
            case WaveVR_ButtonList.EButtons.VolumeUp:
            case WaveVR_ButtonList.EButtons.VolumeDown:
            case WaveVR_ButtonList.EButtons.Bumper:
            case WaveVR_ButtonList.EButtons.A_X:
            case WaveVR_ButtonList.EButtons.B_Y:
            case WaveVR_ButtonList.EButtons.Back:
            case WaveVR_ButtonList.EButtons.Enter:
                inputAttributes[i].id         = (WVR_InputId)buttons[i];
                inputAttributes[i].capability = (uint)WVR_InputType.WVR_InputType_Button;
                inputAttributes[i].axis_type  = WVR_AnalogType.WVR_AnalogType_None;
                break;

            case WaveVR_ButtonList.EButtons.Touchpad:
            case WaveVR_ButtonList.EButtons.Thumbstick:
                inputAttributes[i].id         = (WVR_InputId)buttons[i];
                inputAttributes[i].capability = (uint)(WVR_InputType.WVR_InputType_Button | WVR_InputType.WVR_InputType_Touch | WVR_InputType.WVR_InputType_Analog);
                inputAttributes[i].axis_type  = WVR_AnalogType.WVR_AnalogType_2D;
                break;

            case WaveVR_ButtonList.EButtons.Trigger:
                inputAttributes[i].id         = (WVR_InputId)buttons[i];
                inputAttributes[i].capability = (uint)(WVR_InputType.WVR_InputType_Button | WVR_InputType.WVR_InputType_Touch | WVR_InputType.WVR_InputType_Analog);
                inputAttributes[i].axis_type  = WVR_AnalogType.WVR_AnalogType_1D;
                break;

            default:
                break;
            }

            DEBUG("setupButtonAttributes() " + device + " (" + dev_type + ") " + buttons [i]
                  + ", capability: " + inputAttributes [i].capability
                  + ", analog type: " + inputAttributes [i].axis_type);
        }
    }
Example #19
0
    private void SetEmitter(GameObject gobj)
    {
        WaveVR_Beam _beam = gobj.GetComponent <WaveVR_Beam> ();
        WaveVR_ControllerPointer _pointer = gobj.GetComponent <WaveVR_ControllerPointer> ();

        if (_beam == null && _pointer == null)
        {
            return;
        }

        WaveVR_Controller.EDeviceType _focus_dev = WaveVR_Controller.EDeviceType.Head;
        #if UNITY_EDITOR
        if (Application.isEditor)
        {
            _focus_dev = this.Type;
        }
        else
        #endif
        {
            WVR_DeviceType _focus_dt = WaveVR_Utils.WVR_GetFocusedController();
            if (_focus_dt == WVR_DeviceType.WVR_DeviceType_Controller_Right)
            {
                _focus_dev = WaveVR_Controller.EDeviceType.Dominant;
            }
            if (_focus_dt == WVR_DeviceType.WVR_DeviceType_Controller_Left)
            {
                _focus_dev = WaveVR_Controller.EDeviceType.NonDominant;
            }
        }
        if (_focus_dev == WaveVR_Controller.EDeviceType.Head)
        {
            return;
        }

        if (_focus_dev != this.Type)
        {
            if (_beam != null)
            {
                PrintDebugLog("SetEmitter() focus type: " + _focus_dev + " hide beam.");
                _beam.ShowBeam = false;
            }
            if (_pointer != null)
            {
                PrintDebugLog("SetEmitter() focus type: " + _focus_dev + " hide pointer.");
                _pointer.ShowPointer = false;
            }
        }
    }
Example #20
0
 public Device getDeviceByType(WaveVR_Controller.EDeviceType type)
 {
     if (type == WaveVR_Controller.EDeviceType.Head)
     {
         return(hmd);
     }
     if (type == WaveVR_Controller.EDeviceType.Dominant)
     {
         return(WaveVR_Controller.IsLeftHanded ? controllerLeft : controllerRight);
     }
     if (type == WaveVR_Controller.EDeviceType.NonDominant)
     {
         return(WaveVR_Controller.IsLeftHanded ? controllerRight : controllerLeft);
     }
     return(null);
 }
Example #21
0
    void OnEnable()
    {
        PrintDebugLog("OnEnable");
        if (mLoadingState == LoadingState.LoadingState_LOADING)
        {
            deleteChild("RenderModel doesn't expect model is in loading, delete all children");
        }

        if (WhichHand == ControllerHand.Controller_Dominant)
        {
            deviceType   = WaveVR_Controller.EDeviceType.Dominant;
            modelSpecify = ModelSpecify.MS_Dominant;
        }
        else
        {
            deviceType   = WaveVR_Controller.EDeviceType.NonDominant;
            modelSpecify = ModelSpecify.MS_NonDominant;
        }

        connected = checkConnection();

        if (connected)
        {
            WaveVR.Device _device = WaveVR.Instance.getDeviceByType(this.deviceType);

            if (mLoadingState == LoadingState.LoadingState_LOADED)
            {
                if (isRenderModelNameSameAsPrevious())
                {
                    PrintDebugLog("OnEnable - Controller connected, model was loaded!");
                }
                else
                {
                    deleteChild("Controller load when OnEnable, render model is different!");
                    onLoadController(_device.type);
                }
            }
            else
            {
                PrintDebugLog("Controller load when OnEnable!");
                onLoadController(_device.type);
            }
        }

        WaveVR_Utils.Event.Listen(WaveVR_Utils.Event.DEVICE_CONNECTED, onDeviceConnected);
        WaveVR_Utils.Event.Listen(WaveVR_Utils.Event.OEM_CONFIG_CHANGED, onOEMConfigChanged);
    }
    public bool IsButtonAvailable(WaveVR_Controller.EDeviceType device, WVR_InputId button)
    {
        if (device == WaveVR_Controller.EDeviceType.Head)
        {
            return(this.usableButtons_hmd.Contains(button));
        }
        if (device == WaveVR_Controller.EDeviceType.Dominant)
        {
            return(this.usableButtons_dominant.Contains(button));
        }
        if (device == WaveVR_Controller.EDeviceType.NonDominant)
        {
            return(this.usableButtons_nonDominant.Contains(button));
        }

        return(false);
    }
Example #23
0
    public Device getDeviceByType(WaveVR_Controller.EDeviceType type)
    {
        switch (type)
        {
        case WaveVR_Controller.EDeviceType.Head:
            return(hmd);

        case WaveVR_Controller.EDeviceType.Dominant:
            return(WaveVR_Controller.IsLeftHanded ? controllerLeft : controllerRight);

        case WaveVR_Controller.EDeviceType.NonDominant:
            return(WaveVR_Controller.IsLeftHanded ? controllerRight : controllerLeft);

        default:
            Assert.raiseExceptions = true;
            return(hmd);  // Should not happen
        }
    }
    public void SetupControllerButtonList(WaveVR_Controller.EDeviceType device, List <WaveVR_ButtonList.EControllerButtons> list)
    {
        PrintDebugLog("SetupControllerButtonList() " + device);
        switch (device)
        {
        case WaveVR_Controller.EDeviceType.Dominant:
            this.DominantButtons = list;
            ResetInputRequest(WaveVR_Controller.EDeviceType.Dominant);
            break;

        case WaveVR_Controller.EDeviceType.NonDominant:
            this.NonDominantButtons = list;
            ResetInputRequest(WaveVR_Controller.EDeviceType.NonDominant);
            break;

        default:
            break;
        }
    }
    private void setupButtonAttributes(WaveVR_Controller.EDeviceType device, List <EButtons> buttons, WVR_InputAttribute_t[] inputAttributes, int count)
    {
        WVR_DeviceType _type = WaveVR_Controller.Input(device).DeviceType;

        for (int _i = 0; _i < count; _i++)
        {
            switch (buttons [_i])
            {
            case EButtons.Menu:
            case EButtons.Grip:
            case EButtons.DPadLeft:
            case EButtons.DPadUp:
            case EButtons.DPadRight:
            case EButtons.DPadDown:
            case EButtons.VolumeUp:
            case EButtons.VolumeDown:
            case EButtons.HMDEnter:
                inputAttributes [_i].id         = (WVR_InputId)buttons [_i];
                inputAttributes [_i].capability = (uint)WVR_InputType.WVR_InputType_Button;
                inputAttributes [_i].axis_type  = WVR_AnalogType.WVR_AnalogType_None;
                break;

            case EButtons.Touchpad:
            case EButtons.Thumbstick:
                inputAttributes [_i].id         = (WVR_InputId)buttons [_i];
                inputAttributes [_i].capability = (uint)(WVR_InputType.WVR_InputType_Button | WVR_InputType.WVR_InputType_Touch | WVR_InputType.WVR_InputType_Analog);
                inputAttributes [_i].axis_type  = WVR_AnalogType.WVR_AnalogType_2D;
                break;

            case EButtons.Trigger:
                inputAttributes [_i].id         = (WVR_InputId)buttons [_i];
                inputAttributes [_i].capability = (uint)(WVR_InputType.WVR_InputType_Button | WVR_InputType.WVR_InputType_Touch | WVR_InputType.WVR_InputType_Analog);
                inputAttributes [_i].axis_type  = WVR_AnalogType.WVR_AnalogType_1D;
                break;

            default:
                break;
            }

            PrintDebugLog("setupButtonAttributes() " + device + " (" + _type + ") " + buttons [_i] + " analog type: " + inputAttributes [_i].axis_type);
        }
    }
Example #26
0
    public void OnPointerExit(PointerEventData eventData)
    {
        RaycastHit hit;

        if (m_LeftController && isControllerFocus_L)
        { //L_Controller Leave
            Vector3 fwd_L = m_LeftController.transform.TransformDirection(Vector3.forward);
            if (!Physics.Raycast(m_LeftController.transform.position, fwd_L, out hit))
            {
                isControllerFocus_L = false;
                if (isControllerFocus_R)
                {
                    NonFocusControllerType = WaveVR_Controller.EDeviceType.Dominant;
                    GetComponent <MeshRenderer>().material.SetColor("_Color", Color.red);
                    return;
                }
            }
        }
        NonFocusControllerType = WaveVR_Controller.EDeviceType.Head;

        GetComponent <MeshRenderer>().material.SetColor("_Color", Color.green);
    }
Example #27
0
    public static string GetControllerName(WaveVR_Controller.EDeviceType type)
    {
        string retString = "";

        if (type == WaveVR_Controller.EDeviceType.Head)
        {
            Log.w(LOG_TAG, "EDeviceType is Head");
            return(retString);
        }

        WVR_DeviceType deviceType = WaveVR_Controller.Input(type).DeviceType;

        if (WaveVR_Controller.Input(type).connected)
        {
            int    bufferSize       = 128;
            uint   resultVertLength = 128;
            string parameterName    = "GetRenderModelName";
            IntPtr ptrParameterName = Marshal.StringToHGlobalAnsi(parameterName);
            IntPtr ptrResult        = Marshal.AllocHGlobal(bufferSize);
            uint   ret = Interop.WVR_GetParameters(deviceType, ptrParameterName, ptrResult, resultVertLength);
            if (ret > 0)
            {
                retString = Marshal.PtrToStringAnsi(ptrResult);
            }
            else
            {
                Log.w(LOG_TAG, "WVR_GetParameters returns empty");
            }
        }
        else
        {
            Log.w(LOG_TAG, type + " controller is disconnect");
        }
        Log.i(LOG_TAG, "GetControllerName returns " + retString);
        return(retString);
    }
Example #28
0
    private void BroadcastToObjects(CIndex index)
    {
        var obj = ControllerObjects [(uint)index];

        if (obj != null)
        {
            if (ControllerConnected [(uint)index] == false)
            {
                PrintDebugLog("BroadcastToObjects() disable controller " + index);
                obj.SetActive(false);
            }
            else
            {
                PrintDebugLog("BroadcastToObjects() enable controller " + index);
                // means object with index is not null and connected.
                obj.SetActive(true);
                WaveVR_Controller.EDeviceType _device = index == CIndex.Dominant ?
                                                        WaveVR_Controller.EDeviceType.Dominant :
                                                        WaveVR_Controller.EDeviceType.NonDominant;

                obj.BroadcastMessage("SetDeviceIndex", _device, SendMessageOptions.DontRequireReceiver);
            }
        }
    }
    private void ResetInputRequest(WaveVR_Controller.EDeviceType device)
    {
        DEBUG("ResetInputRequest() " + device);
        switch (device)
        {
        case WaveVR_Controller.EDeviceType.Head:
            createHmdRequestAttributes();
            SetHmdInputRequest();
            break;

        case WaveVR_Controller.EDeviceType.Dominant:
            createDominantRequestAttributes();
            SetDominantInputRequest();
            break;

        case WaveVR_Controller.EDeviceType.NonDominant:
            createNonDominantRequestAttributes();
            SetNonDominantInputRequest();
            break;

        default:
            break;
        }
    }
 public void SetDeviceIndex(WaveVR_Controller.EDeviceType device)
 {
     Log.i(LOG_TAG, "SetDeviceIndex, _index = " + device);
     this.eDevice = device;
 }