Пример #1
0
        void FixedUpdate()
        {
            fixedUpdateCalled = true;

            if (currentProp == lastProp)
            {
                return;
            }

            // Dropping current prop
            if (currentProp == null)
            {
                puppetMaster.RemoveMuscleRecursive(lastProp.muscle, true);
                lastProp.Drop();
            }

            // Picking up to an empty slot
            if (lastProp == null)
            {
                AttachProp(currentProp);
            }

            // Switching props
            if (lastProp != null && currentProp != null)
            {
                puppetMaster.RemoveMuscleRecursive(lastProp.muscle, true);
                AttachProp(currentProp);
            }

            lastProp = currentProp;
        }
Пример #2
0
        /// <summary>
        /// Dropping/Picking up normally works in the fixed update cycle where joints can be properly connected. Use this to drop a prop immediatelly.
        /// </summary>
        public void DropImmediate()
        {
            if (lastProp == null)
            {
                return;
            }
            puppetMaster.RemoveMuscleRecursive(lastProp.muscle, true, false, MuscleRemoveMode.Sever);
            lastProp.Drop();

            currentProp = null;
            lastProp    = null;
        }
Пример #3
0
        void OnJointBreak()
        {
            if (!enabled)
            {
                return;
            }

            puppetMaster.RemoveMuscleRecursive(puppetMaster.muscles[muscleIndex].joint, true, true, MuscleRemoveMode.Numb);
        }
Пример #4
0
 protected void RemoveMusclesOfGroup(Muscle.Group group)
 {
     while (MusclesContainsGroup(group))
     {
         for (int i = 0; i < puppetMaster.muscles.Length; i++)
         {
             if (puppetMaster.muscles[i].props.group == group)
             {
                 puppetMaster.RemoveMuscleRecursive(puppetMaster.muscles[i].joint, true);
                 break;
             }
         }
     }
 }
Пример #5
0
 protected void RemovePropMuscles()
 {
     while (ContainsRemovablePropMuscle())
     {
         for (int i = 0; i < puppetMaster.muscles.Length; i++)
         {
             if (puppetMaster.muscles[i].props.group == Muscle.Group.Prop && !puppetMaster.muscles[i].isPropMuscle)
             {
                 puppetMaster.RemoveMuscleRecursive(puppetMaster.muscles[i].joint, true);
                 break;
             }
         }
     }
 }
        void OnJointBreak()
        {
            if (!enabled)
            {
                return;
            }
            // 确认 没有其它的 joint
            if (GetComponent <Joint>())
            {
                return;
            }


            puppetMaster.RemoveMuscleRecursive(puppetMaster.muscles[muscleIndex].joint, true, true, MuscleRemoveMode.Numb);
        }
 void OnJointBreak()
 {
     puppetMaster.RemoveMuscleRecursive(puppetMaster.muscles[muscleIndex].joint, true, true, MuscleRemoveMode.Numb);
 }