예제 #1
0
        //If the object is a controller, then emit the relevant event for it.
        protected virtual void EmitControllerEvents(GameObject model, bool state)
        {
            GameObject controllerObject = null;

            //Check to see if the given model is either the left or right controller model alias object
            if (VRTK_DeviceFinder.GetModelAliasControllerHand(model) == SDK_BaseController.ControllerHand.Left)
            {
                controllerObject = VRTK_DeviceFinder.GetControllerLeftHand(false);
            }
            else if (VRTK_DeviceFinder.GetModelAliasControllerHand(model) == SDK_BaseController.ControllerHand.Right)
            {
                controllerObject = VRTK_DeviceFinder.GetControllerRightHand(false);
            }

            //if it is then attempt to get the controller events script from the script alias
            if (controllerObject != null && controllerObject.activeInHierarchy)
            {
                VRTK_ControllerEvents controllerEvents = controllerObject.GetComponent <VRTK_ControllerEvents>();
                if (controllerEvents != null)
                {
                    if (state)
                    {
                        controllerEvents.OnControllerVisible(controllerEvents.SetControllerEvent());
                    }
                    else
                    {
                        controllerEvents.OnControllerHidden(controllerEvents.SetControllerEvent());
                    }
                }
            }
        }
예제 #2
0
        // Token: 0x060016AC RID: 5804 RVA: 0x0007A6F8 File Offset: 0x000788F8
        protected virtual void EmitControllerEvents(GameObject model, bool state)
        {
            GameObject gameObject = null;

            if (VRTK_DeviceFinder.GetModelAliasControllerHand(model) == SDK_BaseController.ControllerHand.Left)
            {
                gameObject = VRTK_DeviceFinder.GetControllerLeftHand(false);
            }
            else if (VRTK_DeviceFinder.GetModelAliasControllerHand(model) == SDK_BaseController.ControllerHand.Right)
            {
                gameObject = VRTK_DeviceFinder.GetControllerRightHand(false);
            }
            if (gameObject != null && gameObject.activeInHierarchy)
            {
                VRTK_ControllerEvents component = gameObject.GetComponent <VRTK_ControllerEvents>();
                if (component != null)
                {
                    if (state)
                    {
                        component.OnControllerVisible(component.SetControllerEvent());
                        return;
                    }
                    component.OnControllerHidden(component.SetControllerEvent());
                }
            }
        }
예제 #3
0
 protected virtual void DoActivationButtonPressed(object sender, ControllerInteractionEventArgs e)
 {
     OnActivationButtonPressed(controller.SetControllerEvent(ref activationButtonPressed, true));
     if (EnabledPointerRenderer())
     {
         controllerIndex = e.controllerIndex;
         Toggle(true);
     }
 }
예제 #4
0
        protected virtual void DoActivationButtonPressed(object sender, ControllerInteractionEventArgs e)
        {
            OnActivationButtonPressed(controller.SetControllerEvent(ref activationButtonPressed, true));
            if (EnabledPointerRenderer())
            {
                controllerReference = e.controllerReference;
                Toggle(true);
            }
            //////////////////////////////////////////////////////////////
            //VRTK_TouchpadControl controls = GetComponent<VRTK_TouchpadControl>();
            //controls.enabled = false;

            //////////////////////////////////////////////////////////////
        }
예제 #5
0
        protected virtual void DoGrabObject(object sender, ControllerInteractionEventArgs e)
        {
            /// XXX: Jesse Magic
            /// Ignore grip inputs from primary grabbing controller
            if (grabbedObject != null && grabbedObject.GetComponent <VRTK_InteractableObject>())
            {
                VRTK_InteractableObject objectGrabbedScript = grabbedObject.GetComponent <VRTK_InteractableObject>();
                if (sender.ToString().Substring(0, sender.ToString().IndexOf(" ")) == objectGrabbedScript.GetGrabbingObject().ToString().Substring(0, sender.ToString().IndexOf(" ")))
                {
                    return;
                }
            }

            OnGrabButtonPressed(controllerEvents.SetControllerEvent(ref grabPressed, true));
            AttemptGrabObject();
        }
예제 #6
0
 protected virtual void DoSelectionButtonPressed(object sender, ControllerInteractionEventArgs e)
 {
     OnSelectionButtonPressed(controllerEvents.SetControllerEvent(ref selectionButtonPressed, true));
 }
예제 #7
0
 protected virtual void DoActivationButtonPressed(object sender, ControllerInteractionEventArgs e)
 {
     OnActivationButtonPressed(controllerEvents.SetControllerEvent());
 }
예제 #8
0
 protected virtual void DoGrabObject(object sender, ControllerInteractionEventArgs e)
 {
     OnGrabButtonPressed(controllerEvents.SetControllerEvent(ref grabPressed, true));
     AttemptGrabObject();
 }
 protected virtual void DoActivationButtonPressed(object sender, ControllerInteractionEventArgs e)
 {
     controllerReference = e.controllerReference;
     OnActivationButtonPressed(controllerEvents.SetControllerEvent(ref activationButtonPressed, true));
     PointerActivated();
 }
예제 #10
0
 protected virtual void DoStartUseObject(object sender, ControllerInteractionEventArgs e)
 {
     OnUseButtonPressed(controllerEvents.SetControllerEvent(ref usePressed, true));
     AttemptUseObject();
 }
예제 #11
0
 protected virtual void DoTriggerObject(object sender, ControllerInteractionEventArgs e)
 {
     OnTriggerButtonPressed(controllerEvents.SetControllerEvent(ref triggerPressed, true));
     //Debug.Log("TRIGGER TRIGGER TRIGGER");
     SpawnObject();
 }