Example #1
0
        public void FreezeFingerInArray(BKI_Finger finger, BKI_FreezeTypes freezeType, Collider identifier)
        {
            // If the object that calls the freeze is already in the registry, return. We don't want duplicates to enter the array.
            if (boneJointFrozenValuesRegisteredCols.Contains(identifier))
            {
                return;
            }
            else
            {
                boneJointFrozenValuesRegisteredCols.Add(identifier);
            }

            switch (freezeType)
            {
            case BKI_FreezeTypes.toProximal:
                FreezeToProximal(finger);
                break;

            case BKI_FreezeTypes.toTip:
                FreezeToTip(finger);
                break;

            default:
                return;
            }
        }
        public void RegisterPickupable(Collider c, BKI_Hand hand, BKI_Finger finger, BKI_FreezeTypes freezeType)
        {
            if (c.gameObject == null)
            {
                return;
            }

            switch (hand)
            {
            case BKI_Hand.right:
                if (freezeType == BKI_FreezeTypes.toProximal && registeredPickupableRight[(int)finger] != null)
                {
                    return;
                }
                if (c.GetComponent <IBetterPickupable>() != null && registeredPickupableRight[(int)finger] == null)
                {
                    registeredPickupableRight[(int)finger] = c.GetComponent <IBetterPickupable>().GetPickupable();
                }
                break;

            case BKI_Hand.left:
                if (freezeType == BKI_FreezeTypes.toProximal && registeredPickupableLeft[(int)finger] != null)
                {
                    return;
                }
                if (c.GetComponent <IBetterPickupable>() != null && registeredPickupableLeft[(int)finger] == null)
                {
                    registeredPickupableLeft[(int)finger] = c.GetComponent <IBetterPickupable>().GetPickupable();
                }
                break;
            }
        }
        private void FreezeFinger(BKI_Hand hand, BKI_Finger finger, BKI_FreezeTypes freezeType, Collider c)
        {
            switch (hand)
            {
            case BKI_Hand.right:
                if (BKI_FingerCurler.BKI_Curler_Instance.GetFingerValueRaw(BKI_Hand.right, finger) <= 0.05f)
                {
                    break;
                }
                fingerFrozenRightHand[(int)finger]      = true;
                fingerFrozenValueRightHand[(int)finger] = Mathf.Clamp(BKI_FingerCurler.BKI_Curler_Instance.GetFingerValueRaw(BKI_Hand.right, finger) - 0.1f, 0.1f, 1f);
                rightHandSkeleton.FreezeFingerInArray(finger, freezeType, c);
                break;

            case BKI_Hand.left:
                if (BKI_FingerCurler.BKI_Curler_Instance.GetFingerValueRaw(BKI_Hand.left, finger) <= 0.05f)
                {
                    break;
                }
                fingerFrozenLeftHand[(int)finger]      = true;
                fingerFrozenValueLeftHand[(int)finger] = Mathf.Clamp(BKI_FingerCurler.BKI_Curler_Instance.GetFingerValueRaw(BKI_Hand.left, finger) - 0.1f, 0.1f, 1f);
                leftHandSkeleton.FreezeFingerInArray(finger, freezeType, c);
                break;
            }
            RegisterPickupable(c, hand, finger, freezeType);
        }
Example #4
0
        // Flags the declared finger as no longer frozen.
        public void UnfreezeFinger(BKI_Finger finger, BKI_FreezeTypes type)
        {
            switch (type)
            {
            case BKI_FreezeTypes.toProximal:
                switch (finger)
                {
                case BKI_Finger.thumb:
                    isThumbProxFrozen = false;
                    break;

                case BKI_Finger.index:
                    isIndexProxFrozen = false;
                    break;

                case BKI_Finger.middle:
                    isMiddleProxFrozen = false;
                    break;

                case BKI_Finger.ring:
                    isRingProxFrozen = false;
                    break;

                case BKI_Finger.pinky:
                    isPinkyProxFrozen = false;
                    break;
                }
                break;

            case BKI_FreezeTypes.toTip:
                switch (finger)
                {
                case BKI_Finger.thumb:
                    isThumbTipFrozen = false;
                    break;

                case BKI_Finger.index:
                    isIndexTipFrozen = false;
                    break;

                case BKI_Finger.middle:
                    isMiddleTipFrozen = false;
                    break;

                case BKI_Finger.ring:
                    isRingTipFrozen = false;
                    break;

                case BKI_Finger.pinky:
                    isPinkyTipFrozen = false;
                    break;
                }
                break;
            }
        }
 private void RefreezeFinger(BKI_Hand hand, BKI_Finger finger, BKI_FreezeTypes freezeType, Collider c)
 {
     if (IsValueOverFrozenValue(hand, finger))
     {
         UnfreezeFinger(hand, finger, freezeType, c);
     }
     else
     {
         FreezeFinger(hand, finger, freezeType, c);
     }
 }
        private void UnfreezeFinger(BKI_Hand hand, BKI_Finger finger, BKI_FreezeTypes freezeType, Collider c)
        {
            switch (hand)
            {
            case BKI_Hand.right:
                fingerFrozenRightHand[(int)finger]      = false;
                fingerFrozenValueRightHand[(int)finger] = 0;
                rightHandSkeleton.UnfreezeFingerInArray(finger, freezeType, c);
                break;

            case BKI_Hand.left:
                fingerFrozenLeftHand[(int)finger]      = false;
                fingerFrozenValueLeftHand[(int)finger] = 0;
                leftHandSkeleton.UnfreezeFingerInArray(finger, freezeType, c);
                break;
            }
            UnregisterPickupable(c, hand, finger, freezeType);
        }
        public void UnregisterPickupable(Collider c, BKI_Hand hand, BKI_Finger finger, BKI_FreezeTypes freezeType)
        {
            if (c.GetComponent <IBetterPickupable>() == null)
            {
                return;
            }
            switch (hand)
            {
            case BKI_Hand.right:
                registeredPickupableRight[(int)finger] = null;
                break;

            case BKI_Hand.left:
                registeredPickupableLeft[(int)finger] = null;
                break;
            }
        }