public void EndCollision(Collider collider)
 {
     if (!collider || !VRTK_PlayerObject.IsPlayerObject(collider.gameObject))
     {
         parent.headsetColliding = false;
         parent.collidingWith    = null;
         parent.OnHeadsetCollisionEnded(SetHeadsetCollisionEvent(collider, transform));
     }
 }
 protected virtual void OnTriggerStay(Collider collider)
 {
     if (enabled && !VRTK_PlayerObject.IsPlayerObject(collider.gameObject) && ValidTarget(collider.transform))
     {
         parent.headsetColliding = true;
         parent.collidingWith    = collider;
         parent.OnHeadsetCollisionDetect(SetHeadsetCollisionEvent(collider, transform));
     }
 }
Ejemplo n.º 3
0
 protected virtual void OnCollisionEnter(Collision collision)
 {
     if (!VRTK_PlayerObject.IsPlayerObject(collision.gameObject) && currentValidFloorObject != null && !currentValidFloorObject.Equals(collision.gameObject))
     {
         CheckStepUpCollision(collision);
         currentCollidingObject = collision.gameObject;
         OnStartColliding(SetBodyPhysicsEvent(currentCollidingObject));
     }
 }
Ejemplo n.º 4
0
        protected override void OnEnable()
        {
#pragma warning disable 0618
            controllerEvents = (controller != null && controllerEvents == null ? controller : controllerEvents);
#pragma warning restore 0618
            base.OnEnable();
            attachedTo = (attachedTo == null ? gameObject : attachedTo);
            if (!VRTK_PlayerObject.IsPlayerObject(gameObject))
            {
                VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Pointer);
            }
            SetDefaultValues();
        }
Ejemplo n.º 5
0
        public virtual void EndNearTouch(Collider collider)
        {
            VRTK_InteractableObject checkObject = collider.gameObject.GetComponentInParent <VRTK_InteractableObject>();

            if (!VRTK_PlayerObject.IsPlayerObject(collider.gameObject) && validObject(checkObject))
            {
                if (checkObject != null)
                {
                    checkObject.StopNearTouching(interactNearTouch);
                }
                interactNearTouch.OnControllerNearUntouchInteractableObject(interactNearTouch.interactTouch.SetControllerInteractEvent(collider.gameObject));
            }
        }
Ejemplo n.º 6
0
 // Token: 0x06001A27 RID: 6695 RVA: 0x0008AFA8 File Offset: 0x000891A8
 protected virtual void OnTriggerStay(Collider collider)
 {
     if (this.parent.ignoreTriggerColliders && collider != null && collider.isTrigger)
     {
         return;
     }
     if (base.enabled && !VRTK_PlayerObject.IsPlayerObject(collider.gameObject, VRTK_PlayerObject.ObjectTypes.Null) && this.ValidTarget(collider.transform))
     {
         this.parent.headsetColliding = true;
         this.parent.collidingWith    = collider;
         this.parent.OnHeadsetCollisionDetect(this.SetHeadsetCollisionEvent(collider, base.transform));
     }
 }
Ejemplo n.º 7
0
        protected virtual void OnTriggerStay(Collider collider)
        {
            //当たり判定
            string layerName = LayerMask.LayerToName(collider.gameObject.layer);

            if (layerName == "Dead")
            {
                if (trg == false)
                {
                    Debug.Log("しんだ");
                    GameObject.Find("Decision").GetComponent <Decision>().gameOver("fireWall");
                    trg = true;
                }
            }

            if (layerName == "TutorialDead")
            {
                if (trg == false)
                {
                    Debug.Log("しんだ");
                    GameObject.Find("Decision").GetComponent <Decision>().TutorialDead();
                    trg = true;
                }
            }

            if (layerName == "Clear")
            {
                if (trg == false)
                {
                    Debug.Log("くりあー");
                    GameObject.Find("Decision").GetComponent <Decision>().gameClear();
                    trg = true;
                }
            }

            if (parent.ignoreTriggerColliders && collider != null && collider.isTrigger)
            {
                return;
            }

            if (enabled && !VRTK_PlayerObject.IsPlayerObject(collider.gameObject) && ValidTarget(collider.transform))
            {
                parent.headsetColliding = true;
                parent.collidingWith    = collider;
                parent.OnHeadsetCollisionDetect(SetHeadsetCollisionEvent(collider, transform));
            }
        }
Ejemplo n.º 8
0
        protected override void OnEnable()
        {
#pragma warning disable 0618
            controllerEvents = (controller != null && controllerEvents == null ? controller : controllerEvents);
#pragma warning restore 0618
            base.OnEnable();
            attachedTo = (attachedTo == null ? gameObject : attachedTo);
            if (!VRTK_PlayerObject.IsPlayerObject(gameObject))
            {
                VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Pointer);
            }
            SetDefaultValues();

            if (NoPointerRenderer())
            {
                VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_PARAMETER, "VRTK_Pointer", "VRTK_BasePointerRenderer", "Pointer Renderer"));
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// The ValidLocation method determines if the given target is a location that can be teleported to
        /// </summary>
        /// <param name="target">The Transform that the destination marker is touching.</param>
        /// <param name="destinationPosition">The position in world space that is the destination.</param>
        /// <returns>Returns true if the target is a valid location.</returns>
        public virtual bool ValidLocation(Transform target, Vector3 destinationPosition)
        {
            //If the target is one of the player objects or a UI Canvas then it's never a valid location
            if (VRTK_PlayerObject.IsPlayerObject(target.gameObject) || target.GetComponent <VRTK_UIGraphicRaycaster>())
            {
                return(false);
            }

            bool validNavMeshLocation = false;

            if (target)
            {
                NavMeshHit hit;
                validNavMeshLocation = NavMesh.SamplePosition(destinationPosition, out hit, navMeshLimitDistance, NavMesh.AllAreas);
            }
            if (navMeshLimitDistance == 0f)
            {
                validNavMeshLocation = true;
            }

            return(validNavMeshLocation && target && !(VRTK_PolicyList.Check(target.gameObject, targetListPolicy)));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// The ValidLocation method determines if the given target is a location that can be teleported to
        /// </summary>
        /// <param name="target">The Transform that the destination marker is touching.</param>
        /// <param name="destinationPosition">The position in world space that is the destination.</param>
        /// <returns>Returns `true` if the target is a valid location.</returns>
        public virtual bool ValidLocation(Transform target, Vector3 destinationPosition)
        {
            //If the target is null, one of the player objects, or a UI Canvas then it's never a valid location
            if (target == null || VRTK_PlayerObject.IsPlayerObject(target.gameObject) || target.GetComponent <VRTK_UIGraphicRaycaster>())
            {
                return(false);
            }

            bool validNavMeshLocation = false;

            if (navMeshData != null)
            {
                UnityEngine.AI.NavMeshHit hit;
                validNavMeshLocation = UnityEngine.AI.NavMesh.SamplePosition(destinationPosition, out hit, navMeshData.distanceLimit, navMeshData.validAreas);
            }
            else
            {
                validNavMeshLocation = true;
            }

            return(validNavMeshLocation && !(VRTK_PolicyList.Check(target.gameObject, targetListPolicy)));
        }
Ejemplo n.º 11
0
 protected virtual bool ValidTarget(Collider collider)
 {
     return(!VRTK_PlayerObject.IsPlayerObject(collider.gameObject) && !(VRTK_PolicyList.Check(collider.gameObject, targetListPolicy)));
 }
Ejemplo n.º 12
0
 // Token: 0x06001943 RID: 6467 RVA: 0x00086E0A File Offset: 0x0008500A
 protected virtual bool ValidTarget(Collider collider)
 {
     return(!VRTK_PlayerObject.IsPlayerObject(collider.gameObject, VRTK_PlayerObject.ObjectTypes.Null) && !VRTK_PolicyList.Check(collider.gameObject, this.targetListPolicy));
 }
Ejemplo n.º 13
0
 // Token: 0x0600179A RID: 6042 RVA: 0x0007E4D0 File Offset: 0x0007C6D0
 public virtual bool ValidLocation(Transform target, Vector3 destinationPosition)
 {
     return(!VRTK_PlayerObject.IsPlayerObject(target.gameObject, VRTK_PlayerObject.ObjectTypes.Null) && !target.GetComponent <VRTK_UIGraphicRaycaster>() && !Physics.Linecast(this.player.headObject.transform.position, destinationPosition + new Vector3(0f, 0.2f, 0f), this.player.mainLayerMask, QueryTriggerInteraction.Ignore) && target != null && !VRTK_PolicyList.Check(target.gameObject, this.targetListPolicy));
 }