⚔️MDamager
Last updated
Last updated
This component is the core class to affect character stats, react and interact with other character and objects in a scene.
It uses the IMDamager and IInteractor interfaces.
MAttackTrigger, MMelee, MProjectile ,MShooteable, MExplosion and MBow inherit from MDamager.
E.g. If an animal is affected any of the Damager components The Health Stat will be reduced and the Animal will react by doing a Damage Mode animation.
Enable/Disable the Damager.
Index of the Damager. Often used by the Animator know which damager to enable/disable via an Animation.
Usually, the Animals have more than one Attack Trigger: Horns, Mouth, Claws, Feet, Swords... Each Attack can use this index to activate the proper Damager while making the animation.
Layers to interact with objects. By default, the layer is set that affects only the Animal Layer.
Set the Interaction that the Damager will have with Triggers.
When the Damager is using Raycast or OnTriggerEnter, sometimes it can register colliders inside the same hierarchy the Damager is. When this option is enabled, these colliders will be ignored.
By default, the Owner is the Root of the hierarchy. But it can be set Manually to another gameobject. If this value is set to null, it will be set again to the Root of the hierarchy.
When a Damager register a collider, it will find a Stats Component on its hierarchy and it will apply the modification to a Stat.
Stat modification to apply on the Damager receiver. for more Info see Modify Stat
If this parameter is set to true the Damager Receiver (MDamageable) will ignore its default multiplier. Resulting in pure damage.
The critical damage will apply a chance to increase or decrease the final value of the Stat modifier
Probability of making a critical damage
The Stat Modifier value will be multiplied by this value if the critical chance is true.
When a Damager register a collider, it will apply a force to the attached rigidbody.
Amount of force applied
Type of force to apply on the ApplyForce() method.
The Damager receiver will apply its default Animal Reaction
If the Damage Receiver has any Interactable component it interact with it sending the InteractorID value.
Index to send to the Interactable