Exemplo n.º 1
0
 public static void Register(Collider col, NVRAttachPoint point)
 {
     if (!Colliders.ContainsKey(col))
     {
         Colliders.Add(col, point);
     }
 }
Exemplo n.º 2
0
        protected virtual void Attach(NVRAttachPoint point)
        {
            point.Attached(this);

            AttachedItem  = point.Item;
            AttachedPoint = point;
        }
Exemplo n.º 3
0
        protected virtual void Attach(NVRAttachPoint point)
        {
            point.Attached(this);

            AttachedItem = point.Item;
            AttachedPoint = point;
        }
Exemplo n.º 4
0
 public static void Register(Collider col, NVRAttachPoint point)
 {
     Debug.Assert(false == Colliders.ContainsKey(col));
     if (false == Colliders.ContainsKey(col))
     {
         Colliders.Add(col, point);
     }
 }
Exemplo n.º 5
0
        protected virtual void Detach()
        {
            if (AttachedPoint)
            {
                AttachedPoint.Detached(this);
            }

            AttachedItem       = null;
            AttachedPoint      = null;
            IsTryingToAttach   = false;
            TryingToAttachItem = null;
        }
Exemplo n.º 6
0
        protected virtual void Detach()
        {
            OnDetach(AttachedPoint);
            AttachedPoint.Detached(this);

            if (SetKinematicWhenAttached)
            {
                AttachedItem.Rigidbody.isKinematic = _itemKinematicStatePreAttach;
            }
            // AttachedItem.EndInteraction();

            AttachedItem  = null;
            AttachedPoint = null;
        }
Exemplo n.º 7
0
        protected virtual void Attach(NVRAttachPoint point)
        {
            OnAttach(point);
            point.Attached(this);

            AttachedItem  = point.Item;
            AttachedPoint = point;

            if (SnapToAttachPoint)
            {
                AttachedItem.transform.position = transform.position + (AttachedItem.transform.position - AttachedPoint.transform.position);
            }
            _itemKinematicStatePreAttach = AttachedItem.Rigidbody.isKinematic;
            if (SetKinematicWhenAttached)
            {
                AttachedItem.Rigidbody.isKinematic = true;
            }
        }
Exemplo n.º 8
0
        protected virtual void OnTriggerStay(Collider col)
        {
            if (IsAttached == false)
            {
                NVRAttachPoint point = AttachPointMapper.GetAttachPoint(col);
                if (point != null && point.IsAttached == false)
                {
                    float distance = Vector3.Distance(point.transform.position, transform.position);

                    if (distance < AttachRange)
                    {
                        Attach(point);
                    }
                    else
                    {
                        point.PullTowards(this);
                    }
                }
            }
        }
Exemplo n.º 9
0
        protected virtual void OnTriggerStay(Collider col)
        {
            if (IsAttached == false && CanAttach == true)
            {
                NVRAttachPoint point = AttachPointMapper.GetAttachPoint(col);
                if (point != null && point.IsAttached == false)
                {
                    float distance = Vector3.Distance(point.transform.position, this.transform.position);

                    if (distance < AttachRange)
                    {
                        Attach(point);
                    }
                    else
                    {
                        point.PullTowards(this);
                    }

                    IsTryingToAttach   = true;
                    TryingToAttachItem = col.gameObject.GetComponentInParent <NVRInteractableItem> ();
                }
            }
        }
Exemplo n.º 10
0
 protected virtual void Detach()
 {
     AttachedPoint.Detached(this);
     AttachedItem  = null;
     AttachedPoint = null;
 }
Exemplo n.º 11
0
 public static void Register(Collider col, NVRAttachPoint point)
 {
     Colliders.Add(col, point);
 }
Exemplo n.º 12
0
 public static void Register(Collider col, NVRAttachPoint point)
 {
     Colliders.Add(col, point);
 }
Exemplo n.º 13
0
 protected virtual void Detach()
 {
     AttachedPoint.Detached(this);
     AttachedItem = null;
     AttachedPoint = null;
 }