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.StartMenuPressed  += DoStartMenuPressed;
            events.StartMenuReleased += DoStartMenuReleased;
            events.GripPressed       += DoGripPressed;
            events.GripReleased      += DoGripReleased;
            events.TouchpadPressed   += DoTouchpadPressed;
            events.TouchpadReleased  += DoTouchpadReleased;

            tooltips.ToggleTips(false);
        }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     wandscript = wand.GetComponent <Wand>();
     if (lgrab.GetGrabbedObject() != null)
     {
         weapon                       = lgrab.GetGrabbedObject();
         controllerevents             = RController.GetComponent <VRTK_ControllerEvents>();
         wandscript.controller        = LController.GetComponent <VRTK_ControllerEvents>();
         swordscript.controllerEvents = LController.GetComponent <VRTK_ControllerEvents>();
     }
     else
     {
         weapon                       = rgrab.GetGrabbedObject();
         controllerevents             = RController.GetComponent <VRTK_ControllerEvents>();
         wandscript.controller        = RController.GetComponent <VRTK_ControllerEvents>();
         swordscript.controllerEvents = RController.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;
     }
     controllerevents.ButtonTwoPressed  += DoButtonTwoPressed;
     controllerevents.ButtonTwoReleased += DoButtonTwoReleased;
 }
        private void Start()
        {
            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>();
            tooltips = GetComponentInChildren <VRTK_ControllerTooltips>();

            //Setup controller event listeners
            events.TriggerPressed  += new ControllerInteractionEventHandler(DoTriggerPressed);
            events.TriggerReleased += new ControllerInteractionEventHandler(DoTriggerReleased);

            events.ButtonOnePressed  += new ControllerInteractionEventHandler(DoButtonOnePressed);
            events.ButtonOneReleased += new ControllerInteractionEventHandler(DoButtonOneReleased);

            events.ButtonTwoPressed  += new ControllerInteractionEventHandler(DoButtonTwoPressed);
            events.ButtonTwoReleased += new ControllerInteractionEventHandler(DoButtonTwoReleased);

            events.TouchpadTouchStart += new ControllerInteractionEventHandler(DoTouchpadTouchStart);
            events.TouchpadTouchEnd   += new ControllerInteractionEventHandler(DoTouchpadTouchEnd);

            events.GripPressed  += new ControllerInteractionEventHandler(DoGripPressed);
            events.GripReleased += new ControllerInteractionEventHandler(DoGripReleased);

            //  events.TouchpadPressed += new ControllerInteractionEventHandler(DoTouchpadPressed);
            //  events.TouchpadReleased += new ControllerInteractionEventHandler(DoTouchpadReleased);

            tooltips.ToggleTips(false);
        }
Ejemplo n.º 4
0
 // Token: 0x06001E6E RID: 7790 RVA: 0x0009A0A0 File Offset: 0x000982A0
 private void Start()
 {
     if (base.GetComponent <VRTK_ControllerEvents>() == null)
     {
         VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, new object[]
         {
             "VRTK_RoomExtender_ControllerExample",
             "VRTK_ControllerEvents",
             "the Controller Alias"
         }));
         return;
     }
     if (Object.FindObjectOfType <VRTK_RoomExtender>() == null)
     {
         VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_SCENE, new object[]
         {
             "VRTK_RoomExtender_ControllerExample",
             "VRTK_RoomExtender"
         }));
         return;
     }
     this.roomExtender = Object.FindObjectOfType <VRTK_RoomExtender>();
     base.GetComponent <VRTK_ControllerEvents>().TouchpadPressed  += this.DoTouchpadPressed;
     base.GetComponent <VRTK_ControllerEvents>().TouchpadReleased += this.DoTouchpadReleased;
     base.GetComponent <VRTK_ControllerEvents>().ButtonTwoPressed += this.DoSwitchMovementFunction;
 }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        isDebugActive     = false;
        isTriggerPressed  = false;
        isGripPressed     = false;
        isTouchpadPressed = false;

        isBtnReleased = true;

        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>();

        //Setup controller event listeners

        events.GripPressed  += new ControllerInteractionEventHandler(DoGripPressed);
        events.GripReleased += new ControllerInteractionEventHandler(DoGripReleased);

        events.TriggerPressed  += new ControllerInteractionEventHandler(DoTriggerPressed);
        events.TriggerReleased += new ControllerInteractionEventHandler(DoTriggerReleased);

        events.TouchpadPressed  += new ControllerInteractionEventHandler(DoTouchpadPressed);
        events.TouchpadReleased += new ControllerInteractionEventHandler(DoTouchpadReleased);
    }
Ejemplo n.º 6
0
 // Token: 0x06001E20 RID: 7712 RVA: 0x00098C3C File Offset: 0x00096E3C
 private void Start()
 {
     if (base.GetComponent <VRTK_ControllerEvents>() == null)
     {
         VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, new object[]
         {
             "VRTK_ControllerAppearance_Example",
             "VRTK_ControllerEvents",
             "the same"
         }));
         return;
     }
     this.events                    = base.GetComponent <VRTK_ControllerEvents>();
     this.highligher                = base.GetComponent <VRTK_ControllerHighlighter>();
     this.tooltips                  = base.GetComponentInChildren <VRTK_ControllerTooltips>();
     this.currentPulseColor         = this.pulseColor;
     this.highlighted               = false;
     this.events.TriggerPressed    += this.DoTriggerPressed;
     this.events.TriggerReleased   += this.DoTriggerReleased;
     this.events.ButtonOnePressed  += this.DoButtonOnePressed;
     this.events.ButtonOneReleased += this.DoButtonOneReleased;
     this.events.ButtonTwoPressed  += this.DoButtonTwoPressed;
     this.events.ButtonTwoReleased += this.DoButtonTwoReleased;
     this.events.StartMenuPressed  += this.DoStartMenuPressed;
     this.events.StartMenuReleased += this.DoStartMenuReleased;
     this.events.GripPressed       += this.DoGripPressed;
     this.events.GripReleased      += this.DoGripReleased;
     this.events.TouchpadPressed   += this.DoTouchpadPressed;
     this.events.TouchpadReleased  += this.DoTouchpadReleased;
     this.tooltips.ToggleTips(false, VRTK_ControllerTooltips.TooltipButtons.None);
 }
Ejemplo n.º 7
0
        protected virtual void SetSnapJoint(VRTK_InteractableObject interactableObject)
        {
            Rigidbody snapTo = interactableObject.GetComponent <Rigidbody>();

            // No rigidbody on the object, use parenting instead
            if (snapTo != null && !snapByParenting)
            {
                // Remove all forces on the object
                snapTo.useGravity      = false;
                snapTo.velocity        = Vector3.zero;
                snapTo.angularVelocity = Vector3.zero;

                if (attachmentJoint == null)
                {
                    VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "SnapInteractionArea:" + name, "Joint", "the same", " because the `Snap Type` is set to `Use Joint`"));
                    return;
                }

                attachmentJoint.connectedBody = snapTo;
            }
            else
            {
                originalParent = interactableObject.transform.parent;

                interactableObject.transform.parent = transform;
            }
        }
Ejemplo n.º 8
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.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.StartMenuPressed  += DoStartMenuPressed;
            controllerEvents.StartMenuReleased += DoStartMenuReleased;

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

            controllerEvents.MiddleFingerSenseAxisChanged += DoMiddleFingerSenseAxisChanged;
            controllerEvents.RingFingerSenseAxisChanged   += DoRingFingerSenseAxisChanged;
            controllerEvents.PinkyFingerSenseAxisChanged  += DoPinkyFingerSenseAxisChanged;
        }
        // script attached to the canvas to change the description in the textbox

        /// <summary>
        /// Enable the listeners on both controller and pointer to all events
        /// </summary>
        protected virtual void OnEnable()
        {
            pointer = (pointer == null ? GetComponent <VRTK_DestinationMarker>() : pointer);
            // find the activated pointer
            if (pointer != null)
            {
                controllerEvent = pointer.GetComponent <VRTK_ControllerEvents>();
                GlobalMonitor   = Global.GetComponent <Monitor>();
                controllerEvent.TouchpadPressed += ControllerEvent_TouchpadPressed;
                // event that touchpad is pressed
                controllerEvent.GripClicked += ControllerEvent_GripClicked;
                // event that grip button is pressed
                interact = pointer.GetComponent <VRTK_InteractGrab>();
                interact.GrabButtonReleased += Interact_GrabButtonReleased;
                // event that grab button is released
                pointer.DestinationMarkerEnter += DestinationMarkerEnter;
                // event that pointer enters an object
                pointer.DestinationMarkerHover += DestinationMarkerHover;
                // event that pointer hovers on an object
                pointer.DestinationMarkerExit += DestinationMarkerExit;
                // event that pointer exits an object
                pointer.DestinationMarkerSet += DestinationMarkerSet;
                // event that the destination marker is active in the scene to determine the last destination
                instructionScript = instructionCanvas.GetComponent <Instruction>();
            }
            else
            {
                // print out the error if the pointer cannot be found
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTKExample_PointerObjectHighlighterActivator", "VRTK_DestinationMarker", "the Controller Alias"));
            }
        }
 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;
     }
     GetComponent <VRTK_ControllerEvents> ().ButtonOnePressed += new ControllerInteractionEventHandler(DoButtonOnePressed);
 }
 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;
     }
     GetComponent <VRTK_ControllerEvents>().TouchpadPressed += LController_Event_Listener_TouchpadPressed;
 }
Ejemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        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>();
    }
Ejemplo n.º 13
0
    private void Start()
    {
        if (GetComponent <VRTK_ControllerEvents>() == null)
        {
            VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "Sphere_Spawner", "VRTK_ControllerEvents", "the same"));
            return;
        }

        GetComponent <VRTK_ControllerEvents>().TriggerPressed += new ControllerInteractionEventHandler(DoTriggerPressed);
    }
Ejemplo n.º 14
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;
        }

        controllerEvents.ButtonOnePressed += DoButtonOnePressed;
    }
Ejemplo n.º 15
0
        protected override void Awake()
        {
            originalControllerTongAttachPoint = controllerTongAttachPoint;
            controllerEvents  = (controllerEvents != null ? controllerEvents : GetComponentInParent <VRTK_ControllerEvents>());
            interactTongTouch = (interactTongTouch != null ? interactTongTouch : GetComponentInParent <VRTK_InteractTouch>());
            if (interactTongTouch == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_NOT_INJECTED, "VRTK_InteractGrab", "VRTK_InteractTouch", "interactTouch", "the same or parent"));
            }

            VRTK_SDKManager.AttemptAddBehaviourToToggleOnLoadedSetupChange(this);
        }
Ejemplo n.º 16
0
    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;
        }

        GetComponent <VRTK_ControllerEvents>().TouchpadTouchStart  += DoTouchpadTouchStart;
        GetComponent <VRTK_ControllerEvents>().TouchpadAxisChanged += DoTouchpadAxisChanged;
        GetComponent <VRTK_ControllerEvents>().TouchpadTouchEnd    += DoTouchpadTouchEnd;
    }
Ejemplo n.º 17
0
    private void Start()
    {
        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  += new ControllerInteractionEventHandler(TriggerPressed);
        controllerEvents.TriggerReleased += new ControllerInteractionEventHandler(TriggerRelease);
    }
Ejemplo n.º 18
0
        protected virtual void OnEnable()
        {
            pointer = (pointer == null ? GetComponent <VRTK_DestinationMarker>() : pointer);

            if (pointer != null)
            {
                pointer.DestinationMarkerSet += DestinationMarkerSet;
            }
            else
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTKExample_OptionTileSelector", "VRTK_DestinationMarker", "the Controller Alias"));
            }
        }
    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;
        }

        controllerEvents.StartMenuPressed    += DoStartMenuPressed;
        controllerEvents.TouchpadAxisChanged += DoTouchpadAxisChanged;
        canTurn = true;
    }
Ejemplo n.º 20
0
        private void Start()
        {
            if (GetComponent <VRTK_DestinationMarker>() == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_ControllerPointerEvents_ListenerExample", "VRTK_DestinationMarker", "the Controller Alias"));
                return;
            }

            //Setup controller event listeners
            GetComponent <VRTK_DestinationMarker>().DestinationMarkerEnter += new DestinationMarkerEventHandler(DoPointerIn);
            GetComponent <VRTK_DestinationMarker>().DestinationMarkerExit  += new DestinationMarkerEventHandler(DoPointerOut);
            GetComponent <VRTK_DestinationMarker>().DestinationMarkerSet   += new DestinationMarkerEventHandler(DoPointerDestinationSet);
        }
Ejemplo n.º 21
0
        // Token: 0x06001CF9 RID: 7417 RVA: 0x0009492C File Offset: 0x00092B2C
        protected virtual void OnEnable()
        {
            this.component = base.GetComponent <T>();
            if (this.component != null)
            {
                this.AddListeners(this.component);
                return;
            }
            string name  = base.GetType().Name;
            string name2 = this.component.GetType().Name;

            VRTK_Logger.Error(string.Format("The {0} script requires to be attached to a GameObject that contains a {1} script.", name, name2));
        }
Ejemplo n.º 22
0
    private void Start()
    {
        if (GetComponent <VRTK_InteractTouch>() == null)
        {
            VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_ControllerEvents_ListenerExample", "VRTK_ControllerEvents", "the same"));
            return;
        }

        GetComponent <VRTK_InteractTouch>().ControllerStartTouchInteractableObject   += new ObjectInteractEventHandler(DoTouchStart);
        GetComponent <VRTK_InteractTouch>().ControllerTouchInteractableObject        += new ObjectInteractEventHandler(DoTouch);
        GetComponent <VRTK_InteractTouch>().ControllerStartUntouchInteractableObject += new ObjectInteractEventHandler(DoUntouchStart);
        GetComponent <VRTK_InteractTouch>().ControllerUntouchInteractableObject      += new ObjectInteractEventHandler(DoUntouch);
    }
Ejemplo n.º 23
0
        private void Start()
        {
            if (GetComponent <VRTK_ControllerEvents>() == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "Sphere_Spawner", "VRTK_ControllerEvents", "the same"));
                return;
            }

            GetComponent <VRTK_ControllerEvents>().TriggerPressed  += new ControllerInteractionEventHandler(DoTriggerPressed);
            GetComponent <VRTK_ControllerEvents>().TouchpadPressed += new ControllerInteractionEventHandler(DoTouchpadPressed);
            spawnMe  = GameObject.Find("SpawnMe");
            position = spawnMe.transform.position;
        }
Ejemplo n.º 24
0
    // Use this for initialization
    void Start()
    {
        allLights = GameObject.FindObjectsOfType <Light> ();

        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);
    }
        private void Start()
        {
            if (GetComponent <VRTK_InteractTouch>() == null || GetComponent <VRTK_InteractGrab>() == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_ControllerInteract_ListenerExample", "VRTK_InteractTouch and VRTK_InteractGrab", "the Controller Alias"));
                return;
            }

            //Setup controller event listeners
            GetComponent <VRTK_InteractTouch>().ControllerTouchInteractableObject   += new ObjectInteractEventHandler(DoInteractTouch);
            GetComponent <VRTK_InteractTouch>().ControllerUntouchInteractableObject += new ObjectInteractEventHandler(DoInteractUntouch);
            GetComponent <VRTK_InteractGrab>().ControllerGrabInteractableObject     += new ObjectInteractEventHandler(DoInteractGrab);
            GetComponent <VRTK_InteractGrab>().ControllerUngrabInteractableObject   += new ObjectInteractEventHandler(DoInteractUngrab);
        }
Ejemplo n.º 26
0
        public GameObject PauseMenu;  //Make reference of this gameobject.

        private void Start()
        {
            PauseMenu.SetActive(false);

            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>().ButtonTwoPressed  += new ControllerInteractionEventHandler(DoButtonTwoPressed); //Detect the upper main button of the HTC VIVE controller.
            GetComponent <VRTK_ControllerEvents>().ButtonTwoReleased += new ControllerInteractionEventHandler(DoButtonTwoReleased);
        }
Ejemplo n.º 27
0
 // Token: 0x06001E32 RID: 7730 RVA: 0x0009937C File Offset: 0x0009757C
 private void Start()
 {
     if (base.GetComponent <VRTK_ControllerEvents>() == null)
     {
         VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, new object[]
         {
             "VRTK_ControllerEvents_ListenerExample",
             "VRTK_ControllerEvents",
             "the same"
         }));
         return;
     }
     base.GetComponent <VRTK_ControllerEvents>().TriggerPressed         += this.DoTriggerPressed;
     base.GetComponent <VRTK_ControllerEvents>().TriggerReleased        += this.DoTriggerReleased;
     base.GetComponent <VRTK_ControllerEvents>().TriggerTouchStart      += this.DoTriggerTouchStart;
     base.GetComponent <VRTK_ControllerEvents>().TriggerTouchEnd        += this.DoTriggerTouchEnd;
     base.GetComponent <VRTK_ControllerEvents>().TriggerHairlineStart   += this.DoTriggerHairlineStart;
     base.GetComponent <VRTK_ControllerEvents>().TriggerHairlineEnd     += this.DoTriggerHairlineEnd;
     base.GetComponent <VRTK_ControllerEvents>().TriggerClicked         += this.DoTriggerClicked;
     base.GetComponent <VRTK_ControllerEvents>().TriggerUnclicked       += this.DoTriggerUnclicked;
     base.GetComponent <VRTK_ControllerEvents>().TriggerAxisChanged     += this.DoTriggerAxisChanged;
     base.GetComponent <VRTK_ControllerEvents>().GripPressed            += this.DoGripPressed;
     base.GetComponent <VRTK_ControllerEvents>().GripReleased           += this.DoGripReleased;
     base.GetComponent <VRTK_ControllerEvents>().GripTouchStart         += this.DoGripTouchStart;
     base.GetComponent <VRTK_ControllerEvents>().GripTouchEnd           += this.DoGripTouchEnd;
     base.GetComponent <VRTK_ControllerEvents>().GripHairlineStart      += this.DoGripHairlineStart;
     base.GetComponent <VRTK_ControllerEvents>().GripHairlineEnd        += this.DoGripHairlineEnd;
     base.GetComponent <VRTK_ControllerEvents>().GripClicked            += this.DoGripClicked;
     base.GetComponent <VRTK_ControllerEvents>().GripUnclicked          += this.DoGripUnclicked;
     base.GetComponent <VRTK_ControllerEvents>().GripAxisChanged        += this.DoGripAxisChanged;
     base.GetComponent <VRTK_ControllerEvents>().TouchpadPressed        += this.DoTouchpadPressed;
     base.GetComponent <VRTK_ControllerEvents>().TouchpadReleased       += this.DoTouchpadReleased;
     base.GetComponent <VRTK_ControllerEvents>().TouchpadTouchStart     += this.DoTouchpadTouchStart;
     base.GetComponent <VRTK_ControllerEvents>().TouchpadTouchEnd       += this.DoTouchpadTouchEnd;
     base.GetComponent <VRTK_ControllerEvents>().TouchpadAxisChanged    += this.DoTouchpadAxisChanged;
     base.GetComponent <VRTK_ControllerEvents>().ButtonOnePressed       += this.DoButtonOnePressed;
     base.GetComponent <VRTK_ControllerEvents>().ButtonOneReleased      += this.DoButtonOneReleased;
     base.GetComponent <VRTK_ControllerEvents>().ButtonOneTouchStart    += this.DoButtonOneTouchStart;
     base.GetComponent <VRTK_ControllerEvents>().ButtonOneTouchEnd      += this.DoButtonOneTouchEnd;
     base.GetComponent <VRTK_ControllerEvents>().ButtonTwoPressed       += this.DoButtonTwoPressed;
     base.GetComponent <VRTK_ControllerEvents>().ButtonTwoReleased      += this.DoButtonTwoReleased;
     base.GetComponent <VRTK_ControllerEvents>().ButtonTwoTouchStart    += this.DoButtonTwoTouchStart;
     base.GetComponent <VRTK_ControllerEvents>().ButtonTwoTouchEnd      += this.DoButtonTwoTouchEnd;
     base.GetComponent <VRTK_ControllerEvents>().StartMenuPressed       += this.DoStartMenuPressed;
     base.GetComponent <VRTK_ControllerEvents>().StartMenuReleased      += this.DoStartMenuReleased;
     base.GetComponent <VRTK_ControllerEvents>().ControllerEnabled      += this.DoControllerEnabled;
     base.GetComponent <VRTK_ControllerEvents>().ControllerDisabled     += this.DoControllerDisabled;
     base.GetComponent <VRTK_ControllerEvents>().ControllerIndexChanged += this.DoControllerIndexChanged;
 }
        protected override void OnEnable()
        {
            trackedObjects = new List <Transform>();
            movementList   = new Dictionary <Transform, List <float> >();
            //base.previousYPositions = new Dictionary<Transform, float>();
            previousTriggerAxisPositions = new Dictionary <Transform, float>();
            initalGaze        = Vector3.zero;
            direction         = Vector3.zero;
            previousDirection = Vector3.zero;
            averagePeriod     = 60;
            currentSpeed      = 0f;
            active            = false;

            activeMovement       = false;
            previousEngageButton = engageButton;

            bodyPhysics         = (bodyPhysics != null ? bodyPhysics : GetComponentInChildren <VRTK_BodyPhysics>());
            controllerLeftHand  = VRTK_DeviceFinder.GetControllerLeftHand();
            controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand();

            SetControllerListeners(controllerLeftHand, leftController, ref leftSubscribed);
            SetControllerListeners(controllerRightHand, rightController, ref rightSubscribed);

            headset = VRTK_DeviceFinder.HeadsetTransform();

            SetControlOptions(myControlOptions);

            playArea = VRTK_DeviceFinder.PlayAreaTransform();

            for (int i = 0; i < trackedObjects.Count; i++)
            {
                Transform trackedObj = trackedObjects[i];
                movementList.Add(trackedObj, new List <float>());
                if (isAxisYTheTriggerAxis)
                {
                    previousTriggerAxisPositions.Add(trackedObj, trackedObj.transform.localPosition.y);
                }
                else
                {
                    previousTriggerAxisPositions.Add(trackedObj, trackedObj.transform.localPosition.z);
                }
            }
            if (playArea == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "PlayArea", "Boundaries SDK"));
            }

            userUpVector = trackerPelvis.transform.up;
        }
Ejemplo n.º 29
0
        protected virtual void OnEnable()
        {
            component = GetComponent <T>();

            if (component != null)
            {
                AddListeners(component);
            }
            else
            {
                string eventsScriptName = GetType().Name;
                string scriptName       = component.GetType().Name;
                VRTK_Logger.Error(string.Format("The {0} script requires to be attached to a GameObject that contains a {1} script.", eventsScriptName, scriptName));
            }
        }
    protected virtual void OnEnable()
    {
        if (events == null)
        {
            VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_NOT_INJECTED, "RadialMenuController", "VRTK_ControllerEvents", "events", "the parent"));
            return;
        }
        else
        {
            events.GripPressed         += new ControllerInteractionEventHandler(DoGripPressed);
            events.GripReleased        += new ControllerInteractionEventHandler(DoGripReleased);
            events.TouchpadAxisChanged += new ControllerInteractionEventHandler(DoTouchpadAxisChanged);

            menu.FireHapticPulse += new Colorhistory_RadialMenu.HapticPulseEventHandler(AttemptHapticPulse);
        }
    }