Esempio n. 1
0
        protected virtual void OnTriggerStay(Collider collider)
        {
            GameObject colliderInteractableObject = TriggerStart(collider);

            if (touchedObject == null || collider.transform.IsChildOf(touchedObject.transform))
            {
                triggerIsColliding = true;
            }

            if (touchedObject == null && colliderInteractableObject != null && IsObjectInteractable(collider.gameObject))
            {
                touchedObject = colliderInteractableObject;
                VRTK_InteractableObject touchedObjectScript = touchedObject.GetComponent <VRTK_InteractableObject>();

                //If this controller is not allowed to touch this interactable object then clean up touch and return before initiating a touch.
                if (touchedObjectScript != null && !touchedObjectScript.IsValidInteractableController(gameObject, touchedObjectScript.allowedTouchControllers))
                {
                    CleanupEndTouch();
                    return;
                }
                OnControllerStartTouchInteractableObject(SetControllerInteractEvent(touchedObject));
                StoreTouchedObjectColliders(collider);

                ToggleControllerVisibility(false);
                touchedObjectScript.StartTouching(this);

                OnControllerTouchInteractableObject(SetControllerInteractEvent(touchedObject));
            }
        }
Esempio n. 2
0
        // Token: 0x060015EF RID: 5615 RVA: 0x00077ACC File Offset: 0x00075CCC
        protected virtual void OnTriggerStay(Collider collider)
        {
            GameObject x = this.TriggerStart(collider);

            if (this.touchedObject == null || collider.transform.IsChildOf(this.touchedObject.transform))
            {
                this.triggerIsColliding = true;
            }
            if (this.touchedObject == null && x != null && this.IsObjectInteractable(collider.gameObject))
            {
                this.touchedObject = x;
                VRTK_InteractableObject component = this.touchedObject.GetComponent <VRTK_InteractableObject>();
                if (component != null && !component.IsValidInteractableController(base.gameObject, component.allowedTouchControllers))
                {
                    this.CleanupEndTouch();
                    return;
                }
                this.OnControllerStartTouchInteractableObject(this.SetControllerInteractEvent(this.touchedObject));
                this.StoreTouchedObjectColliders(collider);
                component.ToggleHighlight(true);
                this.ToggleControllerVisibility(false);
                this.CheckRumbleController(component);
                component.StartTouching(this);
                this.OnControllerTouchInteractableObject(this.SetControllerInteractEvent(this.touchedObject));
            }
        }
        protected virtual void OnTriggerStay(Collider collider)
        {
            GameObject colliderInteractableObject = TriggerStart(collider);

            if (touchedObject == null || collider.transform.IsChildOf(touchedObject.transform))
            {
                triggerIsColliding = true;
            }

            // XXX: Jesse Magic
            if (colliderInteractableObject != null && IsObjectInteractable(collider.gameObject) && collider.name == "SwapControllerZone")
            {
                VRTK_InteractableObject collidedObjectScript = colliderInteractableObject.GetComponent <VRTK_InteractableObject>();
                if (collidedObjectScript != null && collidedObjectScript.IsGrabbed() && this.gameObject != collidedObjectScript.GetGrabbingObject())
                {
                    if (!collidedObjectScript.secondaryGrabActionScript.isSwappable)
                    {
                        collidedObjectScript.secondaryGrabActionScript.isSwappable = true;
                        //Debug.Log("Swappin' that shit!");

                        if (collider.transform.Find("Preview"))
                        {
                            collider.transform.Find("Preview").gameObject.SetActive(true);
                        }

                        // Emit touch event of swap zone
                        if (ControllerTouchSwapZone != null)
                        {
                            ControllerTouchSwapZone(this, collider.gameObject);
                        }
                    }
                }
            }

            if (touchedObject == null && colliderInteractableObject != null && IsObjectInteractable(collider.gameObject))
            {
                touchedObject = colliderInteractableObject;
                VRTK_InteractableObject touchedObjectScript = touchedObject.GetComponent <VRTK_InteractableObject>();

                //If this controller is not allowed to touch this interactable object then clean up touch and return before initiating a touch.
                if (touchedObjectScript != null && !touchedObjectScript.IsValidInteractableController(gameObject, touchedObjectScript.allowedTouchControllers))
                {
                    CleanupEndTouch();
                    return;
                }
                OnControllerStartTouchInteractableObject(SetControllerInteractEvent(touchedObject));
                StoreTouchedObjectColliders(collider);

                ToggleControllerVisibility(false);
                touchedObjectScript.StartTouching(this);

                OnControllerTouchInteractableObject(SetControllerInteractEvent(touchedObject));
            }
        }