private void OnTriggerExit(Collider other)
        {
            if (other.tag == "pickupableObject")
            {
                BKI_PickupableObject bpo = GetValidPickupable(other.gameObject);
                if (bpo == null)
                {
                    return;
                }

                if (registeredColliders.Contains(bpo))
                {
                    registeredColliders.Remove(bpo);
                    if (bpo.GetComponent <Valve.VR.InteractionSystem.Interactable>() != null)
                    {
                        bpo.GetComponent <Valve.VR.InteractionSystem.Interactable>().RemoveHighlight();
                    }
                }

                if (bpo.GetPickupable() == pickedUpObject)
                {
                    ReleaseObject();
                }

                if (registeredColliders.Count > 0)
                {
                    BKI_FingerCurler.BKI_Curler_Instance.SetHandUpdateBlend(hand, false);
                }
                else
                {
                    BKI_FingerCurler.BKI_Curler_Instance.SetHandUpdateBlend(hand, true);
                }
            }
        }
Пример #2
0
 public BKI_PickupableObject GetPickupable()
 {
     return(parentObj.GetPickupable());
 }
        private void OnTriggerStay(Collider other)
        {
            BKI_PickupableObject bpo = GetValidPickupable(other.gameObject);

            if (!isHandGripping && pickedUpObject != null)
            {
                ReleaseObject();
            }

            if (bpo != null)
            {
                bpo = bpo.GetPickupable();
                if (!registeredColliders.Contains(bpo))
                {
                    registeredColliders.Add(bpo);
                }
            }

            // Functions as another "TriggerEnter" moment.
            if (pickedUpObject == null && registeredColliders.Count > 0)
            {
                foreach (IBetterPickupable b in registeredColliders)
                {
                    if (BKI_FingerCurler.BKI_Curler_Instance.IsHandGrippingDown(hand))
                    {
                        return;
                    }

                    BKI_PickupableObject bp = null;

                    if (b != null)
                    {
                        bp = b.GetPickupable();
                    }
                    else
                    {
                        continue;
                    }

                    if (bp == null)
                    {
                        continue;
                    }

                    if (BKI_FingerCurler.BKI_Curler_Instance.GetGrippedObject(hand) != null && BKI_FingerCurler.BKI_Curler_Instance.GetGrippedObject(hand).GetPickupable() == bp.GetPickupable())
                    {
                        pickedUpObject = BKI_FingerCurler.BKI_Curler_Instance.GetGrippedObject(hand);
                        pickedUpObject.PickupObject(pickedUpParent);
                        isHoldingObject = true;
                        break;
                    }
                }
            }

            if (registeredColliders.Count > 0)
            {
                BKI_FingerCurler.BKI_Curler_Instance.SetHandUpdateBlend(hand, false);
            }
            else
            {
                BKI_FingerCurler.BKI_Curler_Instance.SetHandUpdateBlend(hand, true);
            }
        }