コード例 #1
0
        // turn control on and off
        public void setState(bool state, ViveControllerModule.EventData eventData)
        {
            if (isActivated == state)
            {
                return;
            }

            Action <GameObject, ViveControllerModule.EventData> value;

            // execute the function
            if (pressPairings.TryGetValue(state, out value))
            {
                if (value != null)
                {
                    value(obj, eventData);
                }
            }
            else
            {
                Console.WriteLine("Key =" + state + " is not found.");
            }

            isActivated = state;
            drawMenuLabels();
        }
コード例 #2
0
 void IGlobalTriggerClickHandler.OnGlobalTriggerClick(ViveControllerModule.EventData eventData)
 {
     if (eventData.currentRaycast != null && eventData.currentRaycast.GetComponent <DOOObject>().type == DOOType.FLOOR)
     {
         Teleport(eventData.worldPosition);
     }
 }
コード例 #3
0
        /// <summary>
        /// Take the event data values from PAD Touch and use radians to return a mapped from DIRECTION ENUM
        /// </summary>
        /// <param name="eventData"></param>
        /// <returns></returns>
        public DIRECTION ParseDirection(ViveControllerModule.EventData eventData)
        {
            // 0.1875
            double rad = Math.Atan2(eventData.touchpadAxis.y, eventData.touchpadAxis.x);

            // value used to map ranges for each direction
            // TODO: move this somewhere
            double range       = 0.375;
            double radianDelta = 2.75;

            // sort dictionary according to ranges
            // we are using a range +- range variable above and finding if our radian is between that range.
            foreach (var item in padValueMap.Where(item =>
            {
                var bottomvalue = (item.Value - range);
                var topvalue = (item.Value + range);
                //Debug.Log("key " + item.Key + " val " + item.Value + " rad " + rad + "bottom " + bottomvalue + " top " + topvalue);

                // if we reach the top reverse the ranges only applies to one value
                if (rad > radianDelta)
                {
                    return(-topvalue < rad && rad < -bottomvalue);
                }
                else
                {
                    return(bottomvalue < rad && rad < topvalue);
                }
            }).ToList())
            {
                //  Debug.Log(item.Key);
                return(item.Key);
            }
            ;
            return(DIRECTION.NONE);
        }
コード例 #4
0
        // trigger the action
        public EditingOjbect trigger(GameObject _obj, ViveControllerModule.EventData eventData)
        {
            if (!isActivated)
            {
                return(null);
            }

            Action <GameObject, ViveControllerModule.EventData> value;

            // execute the function
            if (pressPairings.TryGetValue(true, out value))
            {
                if (value != null)
                {
                    value(_obj, eventData);
                    return(new EditingOjbect(_obj, this.menuEditState));
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                Console.WriteLine("Key =" + true + " is not found.");
                return(null);
            }
        }
コード例 #5
0
        public void OnGlobalTouchpadTouch(ViveControllerModule.EventData eventData)
        {
            //if(currenteditingobject !=null)
            //{
            //    //debug.log(currenteditingobject.editstate);
            //    //debug.log(parseangle(eventdata));
            //    if (currenteditingobject.selectedobject != null)
            //    {
            //        debug.log("rotate");
            //       // currenteditingobject.selectedobject.transform.rotate(vector3.up, currenteditingobject.selectedobject.transform.rotation.eulerangles.y + (float)parseangle(eventdata));
            //       // leantween.rotatearound(currenteditingobject.selectedobject, vector3.up, 5, 0.1f);
            //    }
            //}

            if (eventData.viveControllerModule.Controller.index == leftcontrollerid)
            {
                //  Debug.Log("left");
                leftmenuui.setHover(ParseDirection(eventData));
                //submenu.trigger(eventData.currentRaycast.gameObject, eventData);
                //left
            }
            else
            {
                //  Debug.Log("right");
                rightmenuui.setHover(ParseDirection(eventData));
            };
        }
コード例 #6
0
    void FixedUpdate()
    {
        if (receiver.module == null)
        {
            Debug.LogError("TeleportController " + name + " does not have a module. It requires a module.");
        }

        ViveControllerModule.EventData eventData = (receiver.module as ViveControllerModule).GetEventData();
        if (eventData != null && eventData.currentRaycast != null)
        {
            if (eventData.currentRaycast.GetComponent <TeleportLocation>() != null)
            {
                EnableCursorAndLine(eventData, validCastColor);
            }
            else
            {
                cursor.SetActive(false);
                //  EnableCursorAndLine(eventData, invalidCastColor);
            }
        }
        else
        {
            //  Debug.Log("no raycast");
            DisableCursorAndLine();
        }
    }
コード例 #7
0
ファイル: Grabbable.cs プロジェクト: superbright/reverie
 /// <summary>
 /// This function is called when the trigger is released. Called once per press context.
 /// </summary>
 /// <param name="eventData">The corresponding event data for the module.</param>
 public void OnGlobalTriggerPressUp(ViveControllerModule.EventData eventData)
 {
     //If the grabbing module releases it's trigger, unbind it from this object.
     if (grabbingModule == eventData.viveControllerModule)
     {
         Release(eventData.viveControllerModule);
     }
 }
コード例 #8
0
ファイル: Grabbable.cs プロジェクト: superbright/reverie
 void IPointerTriggerPressUpHandler.OnPointerTriggerPressUp(ViveControllerModule.EventData eventData)
 {
     //If the grabbing module releases it's trigger, unbind it from this object.
     if (grabbingModule == eventData.viveControllerModule)
     {
         Release(eventData.viveControllerModule);
     }
 }
コード例 #9
0
ファイル: Grabbable.cs プロジェクト: superbright/reverie
 void IPointerTriggerPressHandler.OnPointerTriggerPress(ViveControllerModule.EventData eventData)
 {
     //Only accept this call if it's from the module currently grabbing this object.
     if (grabbingModule == eventData.viveControllerModule)
     {
         //Check for a GlobalGrabber if this object should expect one.
         Hold(eventData.viveControllerModule);
     }
 }
コード例 #10
0
ファイル: MenuManager.cs プロジェクト: superbright/reverie
    public void OnGlobalTouchpadPressDown(ViveControllerModule.EventData eventData)
    {
        transform.position = eventData.module.gameObject.transform.position;
        Vector3 updatedrotation = transform.rotation.eulerAngles;

        updatedrotation.y = eventData.module.gameObject.transform.rotation.eulerAngles.y;

        transform.rotation = Quaternion.Euler(updatedrotation);
        transform.LookAt(eventData.module.transform);
    }
コード例 #11
0
ファイル: Grabbable.cs プロジェクト: superbright/reverie
 void IPointerTriggerPressDownHandler.OnPointerTriggerPressDown(ViveControllerModule.EventData eventData)
 {
     //Only "grab" the object if it's within the bounds of the object.
     //If the object has already been grabbed, ignore this event call.
     if (grabbingModule == null && pointerGrab)
     {
         //Check for a GlobalGrabber if this object should expect one.
         Grab(eventData.viveControllerModule);
     }
 }
コード例 #12
0
ファイル: Grabbable.cs プロジェクト: superbright/reverie
 /// <summary>
 /// This function is called when the trigger is initially pressed. Called once per press context.
 /// </summary>
 /// <param name="eventData">The corresponding event data for the module.</param>
 public void OnGlobalTriggerPressDown(ViveControllerModule.EventData eventData)
 {
     //Only "grab" the object if it's within the bounds of the object.
     //If the object has already been grabbed, ignore this event call.
     if (collider.bounds.Contains(eventData.viveControllerModule.transform.position) && grabbingModule == null && colliderGrab)
     {
         //Check for a GlobalGrabber if this object should expect one.
         Grab(eventData.viveControllerModule);
     }
 }
コード例 #13
0
        void IPointerTriggerPressDownHandler.OnPointerTriggerPressDown(ViveControllerModule.EventData eventData)
        {
            if (!inUse)
            {
                GetComponent <Image>().color = ApplicationConfig.Instance.MENULOADINGCOLOR;

                WorldContentManager.Instance.AddObject(index.ToString(), index, transform);
                inUse = true;
            }
            //ObjectFactory.Instance.triggerPrefab(index, transform.position);
        }
コード例 #14
0
        public void OnGlobalGripPressDown(ViveControllerModule.EventData eventData)
        {
            if (eventData.viveControllerModule.Controller.index == leftcontrollerid)
            {
                Debug.Log("left");

                //left
            }
            else
            {
                Debug.Log("right");
            };
        }
コード例 #15
0
 public void OnGlobalTouchpadPressDown(ViveControllerModule.EventData eventData)
 {
     //is left menu
     if (eventData.viveControllerModule.Controller.index == leftcontrollerid)
     {
         DOOType type = eventData.currentRaycast.gameObject.GetComponentInChildren <DOOObject>().type;
         // find matching main menu from DOO type
         MenuItem mainmenu;
         if (leftMenuMap.TryGetValue(type, out mainmenu))
         {
             //find matching submenu from Direction
             MenuItem submenu;
             if (mainmenu.submenuitems.TryGetValue(ParseDirection(eventData), out submenu))
             {
                 currentEditingObject = submenu.trigger(eventData.currentRaycast.gameObject, eventData);
                 mainmenu.ui.setSelected(ParseDirection(eventData));
             }
             else
             {
                 Debug.Log("no action bro");
             }
         }
         else
         {
             //no menu found
         }
     }
     // no its actually right menu
     else
     {
         //find matching submenu from Direction
         MenuItem submenu;
         if (rightmenu.submenuitems.TryGetValue(ParseDirection(eventData), out submenu))
         {
             submenu.trigger(MainMenuManager.Instance.gameObject, eventData);
             //rightmenu.ui.setSelected(ParseDirection(eventData));
         }
         else
         {
             Debug.Log("no action bro");
         }
     }
 }
コード例 #16
0
 void IPointerTriggerPressDownHandler.OnPointerTriggerPressDown(ViveControllerModule.EventData eventData)
 {
     inputManager.textEntry = GetComponent <UnityEngine.UI.InputField>();
     inputManager.ShowKeyboard(Title);
 }
コード例 #17
0
        public double ParseAngle(ViveControllerModule.EventData eventData)
        {
            double rad = Math.Atan2(eventData.touchpadAxis.y, eventData.touchpadAxis.x);

            return(rad * Mathf.Rad2Deg);
        }
コード例 #18
0
 void IPointerTriggerPressDownHandler.OnPointerTriggerPressDown(ViveControllerModule.EventData eventData)
 {
     Debug.Log("load room");
     loadroom();
 }
コード例 #19
0
 void IPointerTriggerClickHandler.OnPointerTriggerClick(ViveControllerModule.EventData eventData)
 {
     Debug.Log("Pointer Trigger Click from module: " + eventData.viveControllerModule.name);
 }
コード例 #20
0
ファイル: Grabbable.cs プロジェクト: superbright/reverie
 public void OnGlobalTouchpadTouch(ViveControllerModule.EventData eventData)
 {
     //  Debug.Log(eventData.touchpadAxis);
 }
コード例 #21
0
 public void OnPointerTriggerPressUp(ViveControllerModule.EventData eventData)
 {
     //throw new NotImplementedException();
 }
コード例 #22
0
ファイル: GuideRuler.cs プロジェクト: superbright/reverie
 public void OnPointerTriggerPressDown(ViveControllerModule.EventData eventData)
 {
     moveObject(eventData.worldPosition, axis);
 }
コード例 #23
0
 public void OnGlobalTriggerClick(ViveControllerModule.EventData eventData)
 {
     Debug.Log("Global Trigger Click from module: " + eventData.viveControllerModule.name);
 }
コード例 #24
0
 void IGlobalTouchpadPressHandler.OnGlobalTouchpadPress(ViveControllerModule.EventData eventData)
 {
     Debug.Log("menu");
 }