Example #1
0
        protected override void OnMuscleHitBehaviour(MuscleHit hit)
        {
            if (!enabled)
            {
                return;
            }

            // If the muscle has been hit via code using MuscleCollisionBroadcaster.Hit(float unPin, Vector3 force, Vector3 position);
            // This is used for shooting based on raycasting instead of physical collisions.
        }
		// When a muscle is hit (through MuscleCollisionBroadcaster.Hit(...))
		protected override void OnMuscleHitBehaviour(MuscleHit hit) {
			// Should we activate the puppet?
			if (masterProps.normalMode == NormalMode.Kinematic) puppetMaster.mode = PuppetMaster.Mode.Active;

			// Unpin the muscle (and other muscles) and add force
			UnPin(hit.muscleIndex, hit.unPin);

			// Add force
			puppetMaster.muscles[hit.muscleIndex].rigidbody.isKinematic = false;
			puppetMaster.muscles[hit.muscleIndex].rigidbody.AddForceAtPosition(hit.force, hit.position);
		}
Example #3
0
        public void OnMuscleHit(MuscleHit hit)
        {
            if (!initiated)
            {
                return;
            }
            if (OnPreMuscleHit != null)
            {
                OnPreMuscleHit(hit);
            }

            OnMuscleHitBehaviour(hit);

            if (OnPostMuscleHit != null)
            {
                OnPostMuscleHit(hit);
            }
        }
Example #4
0
 protected virtual void OnMuscleHitBehaviour(MuscleHit hit)
 {
 }