Пример #1
0
        private void Start()
        {
            if (GetComponent <VRTK_UIPointer>() == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_ControllerUIPointerEvents_ListenerExample", "VRTK_UIPointer", "the Controller Alias"));
                return;
            }

            if (StateManager.Instance.togglePointerOnHit)
            {
                GetComponent <VRTK_UIPointer>().activationMode = VRTK_UIPointer.ActivationMethods.AlwaysOn;
            }

            //Setup controller event listeners
            GetComponent <VRTK_UIPointer>().UIPointerElementEnter     += VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementEnter;
            GetComponent <VRTK_UIPointer>().UIPointerElementExit      += VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementExit;
            GetComponent <VRTK_UIPointer>().UIPointerElementClick     += VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementClick;
            GetComponent <VRTK_UIPointer>().UIPointerElementDragStart += VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementDragStart;
            GetComponent <VRTK_UIPointer>().UIPointerElementDragEnd   += VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementDragEnd;
        }
Пример #2
0
    private void Start()
    {
        if (GetComponent <VRTK_UIPointer>() == null)
        {
            VRTK_Logger.Error("VR_UIPointer_Extension needs VRTK_UIPointer attached.");
            return;
        }

        if (togglePointerOnHit)
        {
            GetComponent <VRTK_UIPointer>().activationMode = VRTK_UIPointer.ActivationMethods.AlwaysOn;
        }

        //Setup controller event listeners
        GetComponent <VRTK_UIPointer>().UIPointerElementEnter     += VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementEnter;
        GetComponent <VRTK_UIPointer>().UIPointerElementExit      += VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementExit;
        GetComponent <VRTK_UIPointer>().UIPointerElementClick     += VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementClick;
        GetComponent <VRTK_UIPointer>().UIPointerElementDragStart += VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementDragStart;
        GetComponent <VRTK_UIPointer>().UIPointerElementDragEnd   += VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementDragEnd;
    }
Пример #3
0
        public void Button_Red()
        {
            VRTK_Logger.Info("Red Button Clicked");

            /*  if(cnt_red%2==0)
             * {
             *  cnt_red++;
             *  g2d1.SetActive(true);
             *  g2d2.SetActive(true);
             *  g2d3.SetActive(true);
             * }
             * else
             * {
             *  cnt_red++;
             *  g2d1.SetActive(false);
             *  g2d2.SetActive(false);
             *  g2d3.SetActive(false);
             * }
             */
            //SceneManager.LoadScene("collision");
        }
    void Start()
    {
        if (GetComponent <VRTK_InteractableObject>() == null)
        {
            VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "ChangePhysicsOnInteraction", "VRTK_InteractableObject"));
            return;
        }

        // Setup object event listeners
        GetComponent <VRTK_InteractableObject>().InteractableObjectTouched   += DoInteractTouch;
        GetComponent <VRTK_InteractableObject>().InteractableObjectUntouched += DoInteractUntouch;
        GetComponent <VRTK_InteractableObject>().InteractableObjectGrabbed   += DoInteractGrab;
        GetComponent <VRTK_InteractableObject>().InteractableObjectUngrabbed += DoInteractUngrab;

        rigidBody = GetComponent <Rigidbody>();

        if (!rigidBody)
        {
            VRTK_Logger.Error("No RigidBody found on this GameObject!");
        }
    }
Пример #5
0
        public bool IsAttemptCorrect()
        {
            if (passwordAttempt.Count != password.Count)
            {
                ClearDisplay();
                return(false);
            }

            bool isAttemptCorrect = true;

            for (int i = 0; i < password.Count; i++)
            {
                if (password[i] != passwordAttempt[i])
                {
                    isAttemptCorrect = false;
                    break;
                }
            }
            VRTK_Logger.Info(string.Format("Lock.Submit {0}", isAttemptCorrect));
            return(isAttemptCorrect);
        }
Пример #6
0
    // Use this for initialization
    void OnEnable()
    {
        laserPointer = GetComponent <VRTK_UIPointer>();
        laserPointer.UIPointerElementClick  -= HandleTriggerClicked;
        laserPointer.UIPointerElementClick  += HandleTriggerClicked;
        laserPointer.SelectionButtonPressed += HandleSelectionPress;
        laserPointer.UIPointerElementEnter  -= HandlePointerIn;
        laserPointer.UIPointerElementEnter  += HandlePointerIn;
        laserPointer.UIPointerElementExit   -= HandlePointerOut;
        laserPointer.UIPointerElementExit   += HandlePointerOut;
        if (GetComponent <VRTK_UIPointer>() == null)
        {
            VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_ControllerUIPointerEvents_ListenerExample", "VRTK_UIPointer", "the Controller Alias"));
            return;
        }



        //Setup controller event listeners
        //GetComponent<VRTK_UIPointer>().UIPointerElementEnter += VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementEnter;
    }
    protected virtual void CreateCollider()
    {
        generateRigidbody = false;

        if (playArea == null)
        {
            VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "PlayArea", "Boundaries SDK"));
            return;
        }

        VRTK_PlayerObject.SetPlayerObject(playArea.gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig);

        GenerateRigidbody();
        GenerateBodyCollider();

        if (playArea.gameObject.layer == 0)
        {
            playArea.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");
        }
        TogglePhysics(enableBodyCollisions);
    }
Пример #8
0
        // Token: 0x06001E61 RID: 7777 RVA: 0x00099E18 File Offset: 0x00098018
        private void DebugLogger(uint index, string action, Transform target, RaycastHit raycastHit, float distance, Vector3 tipPosition)
        {
            string text  = target ? target.name : "<NO VALID TARGET>";
            string text2 = raycastHit.collider ? raycastHit.collider.name : "<NO VALID COLLIDER>";

            VRTK_Logger.Info(string.Concat(new object[]
            {
                "Controller on index '",
                index,
                "' is ",
                action,
                " at a distance of ",
                distance,
                " on object named [",
                text,
                "] on the collider named [",
                text2,
                "] - the pointer tip position is/was: ",
                tipPosition
            }));
        }
Пример #9
0
        // Token: 0x06001D66 RID: 7526 RVA: 0x000963D4 File Offset: 0x000945D4
        protected override void CreateJoint(GameObject obj)
        {
            if (!this.jointHolder)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_NOT_INJECTED, new object[]
                {
                    "VRTK_CustomJointGrabAttach",
                    "Joint",
                    "customJoint",
                    "the same"
                }));
                return;
            }
            Joint  component = this.jointHolder.GetComponent <Joint>();
            string name      = base.gameObject.name;

            VRTK_SharedMethods.CloneComponent(component, obj, true);
            base.gameObject.name = name;
            this.givenJoint      = (obj.GetComponent(component.GetType()) as Joint);
            base.CreateJoint(obj);
        }
Пример #10
0
        public void Button_Pink()
        {
            VRTK_Logger.Info("Pink Button Clicked");

            /* if(cnt_pinkwhole%2==0)
             * {
             *   cnt_pinkwhole++;
             *   foreach (GameObject g3d in g3d)
             *   {
             *       g3d.gameObject.SetActive(true);
             *   }
             * }
             * else
             * {
             *   foreach (GameObject g3d in g3d)
             *   {
             *       g3d.gameObject.SetActive(false);
             *   }
             *   cnt_pinkwhole++;
             * }
             */
        }
Пример #11
0
 // Token: 0x06001ED3 RID: 7891 RVA: 0x0009C7C0 File Offset: 0x0009A9C0
 private void Update()
 {
     if (this.target != null)
     {
         if (this.followRotation)
         {
             base.transform.rotation = this.target.rotation;
         }
         if (this.followPosition)
         {
             base.transform.position = this.target.position;
             return;
         }
     }
     else
     {
         VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.NOT_DEFINED, new object[]
         {
             "target"
         }));
     }
 }
Пример #12
0
 // Token: 0x06001E67 RID: 7783 RVA: 0x00099F8C File Offset: 0x0009818C
 private void Start()
 {
     if (base.GetComponent <VRTK_UIPointer>() == null)
     {
         VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, new object[]
         {
             "VRTK_ControllerUIPointerEvents_ListenerExample",
             "VRTK_UIPointer",
             "the Controller Alias"
         }));
         return;
     }
     if (this.togglePointerOnHit)
     {
         base.GetComponent <VRTK_UIPointer>().activationMode = VRTK_UIPointer.ActivationMethods.AlwaysOn;
     }
     base.GetComponent <VRTK_UIPointer>().UIPointerElementEnter     += this.VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementEnter;
     base.GetComponent <VRTK_UIPointer>().UIPointerElementExit      += this.VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementExit;
     base.GetComponent <VRTK_UIPointer>().UIPointerElementClick     += this.VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementClick;
     base.GetComponent <VRTK_UIPointer>().UIPointerElementDragStart += this.VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementDragStart;
     base.GetComponent <VRTK_UIPointer>().UIPointerElementDragEnd   += this.VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementDragEnd;
 }
Пример #13
0
    private void OnEnable()
    {
        controllerEvents = GetComponent <VRTK_ControllerEvents>();
        if (controllerEvents == null)
        {
            VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_ControllerEvents_ListenerExample", "VRTK_ControllerEvents", "the same"));
            return;
        }

        //Setup controller event listeners
        controllerEvents.TriggerPressed += DoTriggerPressed;

        controllerEvents.ButtonOnePressed  += DoButtonOnePressed;
        controllerEvents.ButtonOneReleased += DoButtonOneReleased;

        controllerEvents.ButtonTwoPressed  += DoButtonTwoPressed;
        controllerEvents.ButtonTwoReleased += DoButtonTwoReleased;

        controllerEvents.ControllerEnabled      += DoControllerEnabled;
        controllerEvents.ControllerDisabled     += DoControllerDisabled;
        controllerEvents.ControllerIndexChanged += DoControllerIndexChanged;
    }
        private void OnEnable()
        {
            if (GetComponent <VRTK_ControllerEvents>() == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_ControllerAppearance_Example", "VRTK_ControllerEvents", "the same"));
                return;
            }

            events            = GetComponent <VRTK_ControllerEvents>();
            highligher        = GetComponent <VRTK_ControllerHighlighter>();
            tooltips          = GetComponentInChildren <VRTK_ControllerTooltips>();
            currentPulseColor = pulseColor;
            highlighted       = false;

            //Setup controller event listeners
            events.TriggerPressed      += DoTriggerPressed;
            events.TriggerReleased     += DoTriggerReleased;
            events.ButtonOnePressed    += DoButtonOnePressed;
            events.ButtonOneReleased   += DoButtonOneReleased;
            events.ButtonTwoPressed    += DoButtonTwoPressed;
            events.ButtonTwoReleased   += DoButtonTwoReleased;
            events.ButtonThreePressed  += DoButtonThreePressed;
            events.ButtonThreeReleased += DoButtonThreeReleased;
            events.ButtonFourPressed   += DoButtonFourPressed;
            events.ButtonFourReleased  += DoButtonFourReleased;
            events.ButtonFivePressed   += DoButtonFivePressed;
            events.ButtonFiveReleased  += DoButtonFiveReleased;
            events.ButtonSixPressed    += DoButtonSixPressed;
            events.ButtonSixReleased   += DoButtonSixReleased;
            events.StartMenuPressed    += DoStartMenuPressed;
            events.StartMenuReleased   += DoStartMenuReleased;
            events.GripPressed         += DoGripPressed;
            events.GripReleased        += DoGripReleased;
            events.TouchpadPressed     += DoTouchpadPressed;
            events.TouchpadReleased    += DoTouchpadReleased;

            tooltips.ToggleTips(false);
        }
Пример #15
0
    protected virtual void Start()
    {
        statutDesc     = false;
        currentPanelId = 0;

        presentationPanel = descPanel.transform.parent.gameObject;

        allPanelMenuItemController = new List <VRTK_PanelMenuItemController>();

        for (int i = 0; i < descPanel.transform.GetChild(0).gameObject.transform.childCount; i++)
        {
            allPanelMenuItemController.Add(descPanel.transform.GetChild(0).gameObject.transform.GetChild(i).gameObject.GetComponent <VRTK_PanelMenuItemController>());
        }

        interactableObject = gameObject;
        if (interactableObject == null || interactableObject.GetComponent <VRTK_InteractableObject>() == null)
        {
            VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "ElevatorCommand", "VRTK_InteractableObject", "a parent"));
            return;
        }

        interactableObject.GetComponent <VRTK_InteractableObject>().InteractableObjectGrabbed   += new InteractableObjectEventHandler(DoInteractableObjectIsGrabbed);
        interactableObject.GetComponent <VRTK_InteractableObject>().InteractableObjectUngrabbed += new InteractableObjectEventHandler(DoInteractableObjectIsUngrabbed);
    }
        /// <summary>
        /// Sets up the event listeners for the different VRTK-supported events.
        /// </summary>
        /// <param name="throwError"></param>
        /// <returns></returns>
        protected override bool SetupListeners(bool throwError)
        {
            objectToMonitor = (objectToMonitor != null ? objectToMonitor : GetComponentInParent <VRTK_InteractableObject>());
            if (objectToMonitor != null)
            {
                objectToMonitor.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.NearTouch, Networked_NearTouchHighlightObject);
                objectToMonitor.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.NearUntouch, Networked_UnHighlightObject);

                objectToMonitor.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.Touch, Networked_TouchHighlightObject);
                objectToMonitor.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.Untouch, Networked_UnHighlightObject);

                objectToMonitor.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.Grab, Networked_GrabHighlightObject);
                objectToMonitor.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.Ungrab, Networked_UnHighlightObject);

                objectToMonitor.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.Use, Networked_UseHighlightObject);
                objectToMonitor.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.Unuse, Networked_UnHighlightObject);
                return(true);
            }
            else if (throwError)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_InteractObjectHighlighter", "VRTK_InteractableObject", "the same or parent"));
            }
            return(false);
        }
Пример #17
0
        protected override bool SetupListeners(bool throwError)
        {
            interactableObject = (interactableObject != null ? interactableObject : GetComponentInParent <VRTK_InteractableObject>());
            if (interactableObject != null)
            {
                // interactableObject.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.NearTouch, NearTouchHighlightObject);
                // interactableObject.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.NearUntouch, NearTouchUnHighlightObject);

                // interactableObject.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.Touch, TouchHighlightObject);
                // interactableObject.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.Untouch, TouchUnHighlightObject);

                interactableObject.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.Grab, OnObjectGrab);
                interactableObject.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.Ungrab, OnObjectUnGrab);

                // interactableObject.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.Use, UseHighlightObject);
                // interactableObject.SubscribeToInteractionEvent(VRTK_InteractableObject.InteractionType.Unuse, UseUnHighlightObject);
                return(true);
            }
            else if (throwError)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_InteractObjectHighlighter", "VRTK_InteractableObject", "the same or parent"));
            }
            return(false);
        }
Пример #18
0
    protected virtual void Start()
    {
        interactableObject = gameObject.transform.parent.gameObject;
        if (interactableObject == null || interactableObject.GetComponent <VRTK_InteractableObject>() == null)
        {
            //VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "PanelMenuController", "VRTK_InteractableObject", "a parent"));
            //return;

            interactableObject = controllerEvents.gameObject;
            isGrabbed          = true;
            BindControllerEvents();
        }
        else
        {
            interactableObject.GetComponent <VRTK_InteractableObject>().InteractableObjectGrabbed   += new InteractableObjectEventHandler(DoInteractableObjectIsGrabbed);
            interactableObject.GetComponent <VRTK_InteractableObject>().InteractableObjectUngrabbed += new InteractableObjectEventHandler(DoInteractableObjectIsUngrabbed);
        }

        canvasObject = gameObject.transform.GetChild(0).gameObject;
        if (canvasObject == null || canvasObject.GetComponent <Canvas>() == null)
        {
            VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "PanelMenuController", "Canvas", "a child"));
        }
    }
Пример #19
0
        protected virtual void MaxLimitReached(object sender, ControllableEventArgs e)
        {
            VRTK_BaseControllable senderButton = sender as VRTK_BaseControllable;

            VRTK_Logger.Info(senderButton.name + " was pushed");
        }
 private void VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementDragEnd(object sender, UIPointerEventArgs e)
 {
     VRTK_Logger.Info("UI Pointer stopped dragging " + e.currentTarget.name + " on Controller index [" + VRTK_ControllerReference.GetRealIndex(e.controllerReference) + "] and the state was " + e.isActive + " ### World Position: " + e.raycastResult.worldPosition);
 }
        private void OnEnable()
        {
            controllerEvents = GetComponent <VRTK_ControllerEvents>();
            if (controllerEvents == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_ControllerEvents_ListenerExample", "VRTK_ControllerEvents", "the same"));
                return;
            }

            //Setup controller event listeners
            controllerEvents.TriggerPressed          += DoTriggerPressed;
            controllerEvents.TriggerReleased         += DoTriggerReleased;
            controllerEvents.TriggerTouchStart       += DoTriggerTouchStart;
            controllerEvents.TriggerTouchEnd         += DoTriggerTouchEnd;
            controllerEvents.TriggerHairlineStart    += DoTriggerHairlineStart;
            controllerEvents.TriggerHairlineEnd      += DoTriggerHairlineEnd;
            controllerEvents.TriggerClicked          += DoTriggerClicked;
            controllerEvents.TriggerUnclicked        += DoTriggerUnclicked;
            controllerEvents.TriggerAxisChanged      += DoTriggerAxisChanged;
            controllerEvents.TriggerSenseAxisChanged += DoTriggerSenseAxisChanged;

            controllerEvents.GripPressed       += DoGripPressed;
            controllerEvents.GripReleased      += DoGripReleased;
            controllerEvents.GripTouchStart    += DoGripTouchStart;
            controllerEvents.GripTouchEnd      += DoGripTouchEnd;
            controllerEvents.GripHairlineStart += DoGripHairlineStart;
            controllerEvents.GripHairlineEnd   += DoGripHairlineEnd;
            controllerEvents.GripClicked       += DoGripClicked;
            controllerEvents.GripUnclicked     += DoGripUnclicked;
            controllerEvents.GripAxisChanged   += DoGripAxisChanged;

            controllerEvents.TouchpadPressed          += DoTouchpadPressed;
            controllerEvents.TouchpadReleased         += DoTouchpadReleased;
            controllerEvents.TouchpadTouchStart       += DoTouchpadTouchStart;
            controllerEvents.TouchpadTouchEnd         += DoTouchpadTouchEnd;
            controllerEvents.TouchpadAxisChanged      += DoTouchpadAxisChanged;
            controllerEvents.TouchpadTwoAxisChanged   += DoTouchpadTwoAxisChanged;
            controllerEvents.TouchpadSenseAxisChanged += DoTouchpadSenseAxisChanged;

            controllerEvents.ButtonOnePressed    += DoButtonOnePressed;
            controllerEvents.ButtonOneReleased   += DoButtonOneReleased;
            controllerEvents.ButtonOneTouchStart += DoButtonOneTouchStart;
            controllerEvents.ButtonOneTouchEnd   += DoButtonOneTouchEnd;

            controllerEvents.ButtonTwoPressed    += DoButtonTwoPressed;
            controllerEvents.ButtonTwoReleased   += DoButtonTwoReleased;
            controllerEvents.ButtonTwoTouchStart += DoButtonTwoTouchStart;
            controllerEvents.ButtonTwoTouchEnd   += DoButtonTwoTouchEnd;

            controllerEvents.ButtonThreePressed    += DoButtonThreePressed;
            controllerEvents.ButtonThreeReleased   += DoButtonThreeReleased;
            controllerEvents.ButtonThreeTouchStart += DoButtonThreeTouchStart;
            controllerEvents.ButtonThreeTouchEnd   += DoButtonThreeTouchEnd;

            controllerEvents.ButtonFourPressed    += DoButtonFourPressed;
            controllerEvents.ButtonFourReleased   += DoButtonFourReleased;
            controllerEvents.ButtonFourTouchStart += DoButtonFourTouchStart;
            controllerEvents.ButtonFourTouchEnd   += DoButtonFourTouchEnd;

            controllerEvents.ButtonFivePressed    += DoButtonFivePressed;
            controllerEvents.ButtonFiveReleased   += DoButtonFiveReleased;
            controllerEvents.ButtonFiveTouchStart += DoButtonFiveTouchStart;
            controllerEvents.ButtonFiveTouchEnd   += DoButtonFiveTouchEnd;

            controllerEvents.ButtonSixPressed    += DoButtonSixPressed;
            controllerEvents.ButtonSixReleased   += DoButtonSixReleased;
            controllerEvents.ButtonSixTouchStart += DoButtonSixTouchStart;
            controllerEvents.ButtonSixTouchEnd   += DoButtonSixTouchEnd;

            controllerEvents.StartMenuPressed  += DoStartMenuPressed;
            controllerEvents.StartMenuReleased += DoStartMenuReleased;

            controllerEvents.ControllerEnabled      += DoControllerEnabled;
            controllerEvents.ControllerDisabled     += DoControllerDisabled;
            controllerEvents.ControllerIndexChanged += DoControllerIndexChanged;

            controllerEvents.MiddleFingerSenseAxisChanged += DoMiddleFingerSenseAxisChanged;
            controllerEvents.RingFingerSenseAxisChanged   += DoRingFingerSenseAxisChanged;
            controllerEvents.PinkyFingerSenseAxisChanged  += DoPinkyFingerSenseAxisChanged;
        }
Пример #22
0
        private void Start()
        {
            if (GetComponent <VRTK_ControllerEvents>() == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_ControllerEvents_ListenerExample", "VRTK_ControllerEvents", "the same"));
                return;
            }

            //Setup controller event listeners
            GetComponent <VRTK_ControllerEvents>().TriggerPressed  += new ControllerInteractionEventHandler(DoTriggerPressed);
            GetComponent <VRTK_ControllerEvents>().TriggerReleased += new ControllerInteractionEventHandler(DoTriggerReleased);

            GetComponent <VRTK_ControllerEvents>().TriggerTouchStart += new ControllerInteractionEventHandler(DoTriggerTouchStart);
            GetComponent <VRTK_ControllerEvents>().TriggerTouchEnd   += new ControllerInteractionEventHandler(DoTriggerTouchEnd);

            GetComponent <VRTK_ControllerEvents>().TriggerHairlineStart += new ControllerInteractionEventHandler(DoTriggerHairlineStart);
            GetComponent <VRTK_ControllerEvents>().TriggerHairlineEnd   += new ControllerInteractionEventHandler(DoTriggerHairlineEnd);

            GetComponent <VRTK_ControllerEvents>().TriggerClicked   += new ControllerInteractionEventHandler(DoTriggerClicked);
            GetComponent <VRTK_ControllerEvents>().TriggerUnclicked += new ControllerInteractionEventHandler(DoTriggerUnclicked);

            GetComponent <VRTK_ControllerEvents>().TriggerAxisChanged += new ControllerInteractionEventHandler(DoTriggerAxisChanged);

            GetComponent <VRTK_ControllerEvents>().GripPressed  += new ControllerInteractionEventHandler(DoGripPressed);
            GetComponent <VRTK_ControllerEvents>().GripReleased += new ControllerInteractionEventHandler(DoGripReleased);

            GetComponent <VRTK_ControllerEvents>().GripTouchStart += new ControllerInteractionEventHandler(DoGripTouchStart);
            GetComponent <VRTK_ControllerEvents>().GripTouchEnd   += new ControllerInteractionEventHandler(DoGripTouchEnd);

            GetComponent <VRTK_ControllerEvents>().GripHairlineStart += new ControllerInteractionEventHandler(DoGripHairlineStart);
            GetComponent <VRTK_ControllerEvents>().GripHairlineEnd   += new ControllerInteractionEventHandler(DoGripHairlineEnd);

            GetComponent <VRTK_ControllerEvents>().GripClicked   += new ControllerInteractionEventHandler(DoGripClicked);
            GetComponent <VRTK_ControllerEvents>().GripUnclicked += new ControllerInteractionEventHandler(DoGripUnclicked);

            GetComponent <VRTK_ControllerEvents>().GripAxisChanged += new ControllerInteractionEventHandler(DoGripAxisChanged);

            GetComponent <VRTK_ControllerEvents>().TouchpadPressed  += new ControllerInteractionEventHandler(DoTouchpadPressed);
            GetComponent <VRTK_ControllerEvents>().TouchpadReleased += new ControllerInteractionEventHandler(DoTouchpadReleased);

            GetComponent <VRTK_ControllerEvents>().TouchpadTouchStart += new ControllerInteractionEventHandler(DoTouchpadTouchStart);
            GetComponent <VRTK_ControllerEvents>().TouchpadTouchEnd   += new ControllerInteractionEventHandler(DoTouchpadTouchEnd);

            GetComponent <VRTK_ControllerEvents>().TouchpadAxisChanged += new ControllerInteractionEventHandler(DoTouchpadAxisChanged);

            GetComponent <VRTK_ControllerEvents>().ButtonOnePressed  += new ControllerInteractionEventHandler(DoButtonOnePressed);
            GetComponent <VRTK_ControllerEvents>().ButtonOneReleased += new ControllerInteractionEventHandler(DoButtonOneReleased);

            GetComponent <VRTK_ControllerEvents>().ButtonOneTouchStart += new ControllerInteractionEventHandler(DoButtonOneTouchStart);
            GetComponent <VRTK_ControllerEvents>().ButtonOneTouchEnd   += new ControllerInteractionEventHandler(DoButtonOneTouchEnd);

            GetComponent <VRTK_ControllerEvents>().ButtonTwoPressed  += new ControllerInteractionEventHandler(DoButtonTwoPressed);
            GetComponent <VRTK_ControllerEvents>().ButtonTwoReleased += new ControllerInteractionEventHandler(DoButtonTwoReleased);

            GetComponent <VRTK_ControllerEvents>().ButtonTwoTouchStart += new ControllerInteractionEventHandler(DoButtonTwoTouchStart);
            GetComponent <VRTK_ControllerEvents>().ButtonTwoTouchEnd   += new ControllerInteractionEventHandler(DoButtonTwoTouchEnd);

            GetComponent <VRTK_ControllerEvents>().StartMenuPressed  += new ControllerInteractionEventHandler(DoStartMenuPressed);
            GetComponent <VRTK_ControllerEvents>().StartMenuReleased += new ControllerInteractionEventHandler(DoStartMenuReleased);

            GetComponent <VRTK_ControllerEvents>().ControllerEnabled  += new ControllerInteractionEventHandler(DoControllerEnabled);
            GetComponent <VRTK_ControllerEvents>().ControllerDisabled += new ControllerInteractionEventHandler(DoControllerDisabled);

            GetComponent <VRTK_ControllerEvents>().ControllerIndexChanged += new ControllerInteractionEventHandler(DoControllerIndexChanged);
        }
 private void DebugLogger(uint index, string action, GameObject target)
 {
     VRTK_Logger.Info("Controller on index '" + index + "' is " + action + " an object named " + target.name);
 }
Пример #24
0
 private void handlePush(object sender, Control3DEventArgs e)
 {
     VRTK_Logger.Info("Pushed");
     OnPush.Invoke();
 }
        protected virtual GameObject CreateHighlightModel(GameObject givenOutlineModel, string givenOutlineModelPath)
        {
            if (givenOutlineModel != null)
            {
                givenOutlineModel = (givenOutlineModel.GetComponent <Renderer>() ? givenOutlineModel : givenOutlineModel.GetComponentInChildren <Renderer>().gameObject);
            }
            else if (givenOutlineModelPath != "")
            {
                var getChildModel = transform.FindChild(givenOutlineModelPath);
                givenOutlineModel = (getChildModel ? getChildModel.gameObject : null);
            }

            GameObject copyModel = givenOutlineModel;

            if (copyModel == null)
            {
                copyModel = (GetComponent <Renderer>() ? gameObject : GetComponentInChildren <Renderer>().gameObject);
            }

            if (copyModel == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_OutlineObjectCopyHighlighter", "Renderer", "the same or child", " to add the highlighter to"));
                return(null);
            }

            GameObject highlightModel = new GameObject(name + "_HighlightModel");

            highlightModel.transform.SetParent(copyModel.transform.parent, false);
            highlightModel.transform.localPosition = copyModel.transform.localPosition;
            highlightModel.transform.localRotation = copyModel.transform.localRotation;
            highlightModel.transform.localScale    = copyModel.transform.localScale;
            highlightModel.transform.SetParent(transform);

            foreach (var component in copyModel.GetComponents <Component>())
            {
                if (Array.IndexOf(copyComponents, component.GetType().ToString()) >= 0)
                {
                    VRTK_SharedMethods.CloneComponent(component, highlightModel);
                }
            }

            var copyMesh      = copyModel.GetComponent <MeshFilter>();
            var highlightMesh = highlightModel.GetComponent <MeshFilter>();

            if (highlightMesh)
            {
                if (enableSubmeshHighlight)
                {
                    List <CombineInstance> combine = new List <CombineInstance>();

                    for (int i = 0; i < copyMesh.mesh.subMeshCount; i++)
                    {
                        CombineInstance ci = new CombineInstance();
                        ci.mesh         = copyMesh.mesh;
                        ci.subMeshIndex = i;
                        ci.transform    = copyMesh.transform.localToWorldMatrix;
                        combine.Add(ci);
                    }

                    highlightMesh.mesh = new Mesh();
                    highlightMesh.mesh.CombineMeshes(combine.ToArray(), true, false);
                }
                else
                {
                    highlightMesh.mesh = copyMesh.mesh;
                }

                highlightModel.GetComponent <Renderer>().material = stencilOutline;
            }
            highlightModel.SetActive(false);

            VRTK_PlayerObject.SetPlayerObject(highlightModel, VRTK_PlayerObject.ObjectTypes.Highlighter);

            return(highlightModel);
        }
Пример #26
0
 public void Activate()
 {
     VRTK_Logger.Info("Cube activated: " + number);
 }
Пример #27
0
 private void handlePush(object sender, Control3DEventArgs e)
 {
     VRTK_Logger.Info("Pushed");
     Whiteboard.Clear();
 }
Пример #28
0
 private void DebugLogger(uint index, string button, string action, ControllerInteractionEventArgs e)
 {
     VRTK_Logger.Info("Controller on index '" + index + "' " + button + " has been " + action
                      + " with a pressure of " + e.buttonPressure + " / trackpad axis at: " + e.touchpadAxis + " (" + e.touchpadAngle + " degrees)");
 }
Пример #29
0
 public void CreateCanvas()
 {
     VRTK_Logger.Info("Credits Button Clicked");
     StartCoroutine(CreateCanvasOnNextFrame());
 }
Пример #30
0
 public void Enter()
 {
     VRTK_Logger.Info("You've typed [" + input.text + "]");
     input.text = "";
     EnterBool  = true;
 }