コード例 #1
0
        // Token: 0x060018DE RID: 6366 RVA: 0x00084848 File Offset: 0x00082A48
        protected virtual void PointerSet()
        {
            if (!base.enabled || !this.destinationSetActive || !this.pointerContactTarget || !this.CanActivate() || this.InvalidConstantBeam())
            {
                return;
            }
            this.activateDelayTimer = Time.time + this.activateDelay;
            VRTK_InteractableObject component = this.pointerContactTarget.GetComponent <VRTK_InteractableObject>();

            if (this.PointerActivatesUseAction(component))
            {
                if (component.IsUsing(null))
                {
                    component.StopUsing(this.controller.gameObject);
                    this.interactableObject.usingState = 0;
                }
                else if (!component.holdButtonToUse)
                {
                    component.StartUsing(this.controller.gameObject);
                    this.interactableObject.usingState++;
                }
            }
            if ((!this.playAreaCursor || !this.playAreaCursor.HasCollided()) && !this.PointerActivatesUseAction(this.interactableObject))
            {
                this.OnDestinationMarkerSet(this.SetDestinationMarkerEvent(this.pointerContactDistance, this.pointerContactTarget, this.pointerContactRaycastHit, this.destinationPosition, this.controllerReference, false, null));
            }
            if (!this.isActive)
            {
                this.destinationSetActive = false;
            }
        }
コード例 #2
0
        protected virtual void PointerSet()
        {
            if (!isActive || !pointerContactTarget)
            {
                return;
            }

            VRTK_InteractableObject interactableObject = pointerContactTarget.GetComponent <VRTK_InteractableObject>();

            if (interactableObject && interactableObject.pointerActivatesUseAction)
            {
                if (interactableObject.IsUsing())
                {
                    interactableObject.StopUsing(this.gameObject);
                }
                else if (!interactableObject.holdButtonToUse)
                {
                    interactableObject.StartUsing(this.gameObject);
                }
            }

            if (!playAreaCursorCollided && (interactableObject == null || !interactableObject.pointerActivatesUseAction))
            {
                OnDestinationMarkerSet(SeDestinationMarkerEvent(pointerContactDistance, pointerContactTarget, destinationPosition, controllerIndex));
            }
        }
コード例 #3
0
        private void StartUseAction(Transform target)
        {
            interactableObject = target.GetComponent <VRTK_InteractableObject>();
            bool cannotUseBecauseNotGrabbed = (interactableObject && interactableObject.useOnlyIfGrabbed && !interactableObject.IsGrabbed());

            if (PointerActivatesUseAction(interactableObject) && interactableObject.holdButtonToUse && !cannotUseBecauseNotGrabbed)
            {
                interactableObject.StartUsing(gameObject);
            }
        }
コード例 #4
0
        protected virtual void StartUseAction(Transform target)
        {
            pointerInteractableObject = target.GetComponent <VRTK_InteractableObject>();
            bool cannotUseBecauseNotGrabbed = (pointerInteractableObject && pointerInteractableObject.useOnlyIfGrabbed && !pointerInteractableObject.IsGrabbed());

            if (interactUse != null && PointerActivatesUseAction(pointerInteractableObject) && pointerInteractableObject.holdButtonToUse && !cannotUseBecauseNotGrabbed && pointerInteractableObject.usingState == 0)
            {
                pointerInteractableObject.StartUsing(interactUse);
                pointerInteractableObject.usingState++;
            }
        }
コード例 #5
0
ファイル: VRTK_WorldPointer.cs プロジェクト: adlanar/DoodleVR
        protected virtual void PointerIn()
        {
            if (!enabled || !pointerContactTarget)
            {
                return;
            }

            OnDestinationMarkerEnter(SetDestinationMarkerEvent(pointerContactDistance, pointerContactTarget, destinationPosition, controllerIndex));

            interactableObject = pointerContactTarget.GetComponent <VRTK_InteractableObject>();
            if (interactableObject && interactableObject.pointerActivatesUseAction && interactableObject.holdButtonToUse)
            {
                interactableObject.StartUsing(gameObject);
            }
        }
コード例 #6
0
 protected virtual void AttemptUseOnSet(Transform target)
 {
     if (pointerInteractableObject != null && target != null && interactUse != null && PointerActivatesUseAction(pointerInteractableObject))
     {
         if (pointerInteractableObject.IsUsing())
         {
             pointerInteractableObject.StopUsing(interactUse);
             pointerInteractableObject.usingState = 0;
         }
         else if (!pointerInteractableObject.holdButtonToUse)
         {
             pointerInteractableObject.StartUsing(interactUse);
             pointerInteractableObject.usingState++;
         }
     }
 }
コード例 #7
0
        protected virtual void PointerIn()
        {
            if (!enabled || !pointerContactTarget)
            {
                return;
            }

            OnDestinationMarkerEnter(SetDestinationMarkerEvent(pointerContactDistance, pointerContactTarget, destinationPosition, controllerIndex));

            interactableObject = pointerContactTarget.GetComponent <VRTK_InteractableObject>();
            bool cannotUseBecauseNotGrabbed = (interactableObject && interactableObject.useOnlyIfGrabbed && !interactableObject.IsGrabbed());

            if (interactableObject && interactableObject.pointerActivatesUseAction && interactableObject.holdButtonToUse && !cannotUseBecauseNotGrabbed)
            {
                interactableObject.StartUsing(gameObject);
            }
        }
コード例 #8
0
ファイル: VRTK_InteractUse.cs プロジェクト: trideka/VRTK
        protected virtual void UseInteractedObject(GameObject touchedObject)
        {
            if ((usingObject == null || usingObject != touchedObject) && IsObjectUsable(touchedObject))
            {
                usingObject = touchedObject;
                OnControllerStartUseInteractableObject(interactTouch.SetControllerInteractEvent(usingObject));
                VRTK_InteractableObject usingObjectScript = usingObject.GetComponent <VRTK_InteractableObject>();

                if (!usingObjectScript.IsValidInteractableController(controllerReference.scriptAlias, usingObjectScript.allowedUseControllers))
                {
                    usingObject = null;
                    return;
                }

                usingObjectScript.StartUsing(controllerReference.scriptAlias);
                ToggleControllerVisibility(false);
                AttemptHaptics();
                OnControllerUseInteractableObject(interactTouch.SetControllerInteractEvent(usingObject));
            }
        }
コード例 #9
0
 // Token: 0x06001628 RID: 5672 RVA: 0x000788F8 File Offset: 0x00076AF8
 protected virtual void UseInteractedObject(GameObject touchedObject)
 {
     if ((this.usingObject == null || this.usingObject != touchedObject) && this.IsObjectUsable(touchedObject) && this.interactTouch != null)
     {
         this.usingObject = touchedObject;
         this.OnControllerStartUseInteractableObject(this.interactTouch.SetControllerInteractEvent(this.usingObject));
         VRTK_InteractableObject vrtk_InteractableObject = (this.usingObject != null) ? this.usingObject.GetComponent <VRTK_InteractableObject>() : null;
         if (vrtk_InteractableObject != null)
         {
             if (!vrtk_InteractableObject.IsValidInteractableController(base.gameObject, vrtk_InteractableObject.allowedUseControllers))
             {
                 this.usingObject = null;
                 return;
             }
             vrtk_InteractableObject.StartUsing(this);
             this.ToggleControllerVisibility(false);
             this.AttemptHaptics();
             this.OnControllerUseInteractableObject(this.interactTouch.SetControllerInteractEvent(this.usingObject));
         }
     }
 }
コード例 #10
0
        protected virtual void UseInteractedObject(GameObject touchedObject)
        {
            if ((usingObject == null || usingObject != touchedObject) && IsObjectUsable(touchedObject) && interactTouch != null)
            {
                usingObject = touchedObject;
                OnControllerStartUseInteractableObject(interactTouch.SetControllerInteractEvent(usingObject));
                VRTK_InteractableObject usingObjectScript = (usingObject != null ? usingObject.GetComponent<VRTK_InteractableObject>() : null);

                if (usingObjectScript != null)
                {
                    if (!usingObjectScript.IsValidInteractableController(gameObject, usingObjectScript.allowedUseControllers))
                    {
                        usingObject = null;
                        return;
                    }

                    usingObjectScript.StartUsing(this);
                    ToggleControllerVisibility(false);
                    OnControllerUseInteractableObject(interactTouch.SetControllerInteractEvent(usingObject));
                }
            }
        }
コード例 #11
0
        protected virtual void PointerIn()
        {
            // 射线没有击中任何东西则返回
            if (!enabled || !pointerContactTarget)
            {
                return;
            }

            // 回调委托给自己的事件
            OnDestinationMarkerEnter(SetDestinationMarkerEvent(pointerContactDistance, pointerContactTarget, destinationPosition, controllerIndex));

            // 获取被击中物体的VRTK_InteractableObject脚本,如果不能交互则获取不到,为null
            interactableObject = pointerContactTarget.GetComponent <VRTK_InteractableObject>();

            // 判断这个物体的交互方式,如果此物体只有被抓取才能交互则为true
            bool cannotUseBecauseNotGrabbed = (interactableObject && interactableObject.useOnlyIfGrabbed && !interactableObject.IsGrabbed());

            //使用物体
            if (interactableObject && interactableObject.pointerActivatesUseAction && interactableObject.holdButtonToUse && !cannotUseBecauseNotGrabbed)
            {
                interactableObject.StartUsing(gameObject);
            }
        }
コード例 #12
0
        private void StartUseAction(Transform target)
        {
            interactableObject = target.GetComponent<VRTK_InteractableObject>();
            bool cannotUseBecauseNotGrabbed = (interactableObject && interactableObject.useOnlyIfGrabbed && !interactableObject.IsGrabbed());

            if (PointerActivatesUseAction(interactableObject) && interactableObject.holdButtonToUse && !cannotUseBecauseNotGrabbed)
            {
                interactableObject.StartUsing(gameObject);
            }
        }