コード例 #1
0
 void Start()
 {
     vp = GetComponent <VRPickup>();
     if (hand && hand.attachedObject == null)
     {
         hand.AttachToHand(vp);
     }
 }
コード例 #2
0
 public void AttachToHand(VRPickup pickup)
 {
     if (isHolding)
     {
         Debug.LogAssertion(gameObject.name + ": Trying to attach pickup on an unempty hand");
         return;
     }
     pickup.AttachToHand(this);
 }
コード例 #3
0
 public bool RequestDetachFromHand(VRPickup requster)
 {
     if (requster == null || requster != m_attachedObject)
     {
         Debug.LogError(gameObject.name + ": Error on detaching pickup from hand: wrong or null pickup");
         return(false);
     }
     m_attachedObject = null;
     return(true);
 }
コード例 #4
0
 public bool RequestAttachToHand(VRPickup requster)
 {
     if (attachedObject != null)
     {
         Debug.LogError(gameObject.name + ": Error on attaching pickup to hand: unempty hand");
         return(false);
     }
     m_attachedObject = requster;
     return(true);
 }
コード例 #5
0
        void OnTriggerExit(Collider other)
        {
            VRPickup pickup = other.GetComponentInParent <VRPickup>();

            if (pickup)
            {
                if (!pickupsInTrigger.Contains(pickup))
                {
                    Debug.LogError(gameObject.name + ": An unlisted pickup exit the trigger: " + pickup);
                    return;
                }
                pickupsInTrigger.Remove(pickup);
            }
        }
コード例 #6
0
        void OnTriggerEnter(Collider other)
        {
            VRPickup pickup = other.GetComponentInParent <VRPickup>();

            if (pickup)
            {
                if (pickupsInTrigger.Contains(pickup))
                {
                    Debug.LogError(gameObject.name + ": An pickup enters the trigger twice: " + pickup);
                    return;
                }
                pickupsInTrigger.Add(pickup);
            }
        }