🤕MDamageable
✔
Last updated
✔
Last updated
This component is in charge of connecting the Animal Controller to any Damager Component. This will receive the Direction, Stat to modify and it will make an Animal Reaction accordingly to the Damager information
This Component Requires a reference to the Stats Component
This component can be also used on child colliders to simulate specific damages.
E.g.
You can add a MDamageable Component to the Head collider, and add a Multiplier of 2 to simulate Headshots that make twice the damage value.
You can add a MDamageable Component to the Chest collider, Shield, or Head Helmet, add a Multiplier of 0.5 to simulate Defense, and only do half the Damage.
The component can also be set inside the Animal Hierarchy. This is very useful to create different damages and reactions to the animal.
For example, you can add an MDamageable component to the Head Collider, with a multiplier of 2 and a Reaction set to Play the Stun Action for 3 Seconds. If the Animal receives direct damage to the head collider, the Damage value will double and it will play a stun animation instead of the Damage Animations.
The root Damageable gameobject, if this is a child gameobject
Type of surface the damageable is e.g. Wood, Flesh, Metal etc.
Reaction to apply on the Animal when receiving Damage. By Default it will apply Mode Damage on the Animal. but you can change it and use any other Animal Reaction.
You can add a MDamageable Component to the Head collider and change the reaction to activate a Stun Animation instead.
The reaction to apply to the animal if a critical hit is achieved.
The reaction to apply to the animal that is dealing the damage to this gameobject
This damageable will ignore the reaction coming from the damager. Use this when the damager needs to use the default reaction
Reference to the Stats component
Value to apply an extra modification to the Stats to make Double Damage, if is set to greater than 1; or acts as Defense value if is set to a value between 0-1.
A list of elements (Fire, Ice, Rock, Lightning etc.) and their associated damage multipliers that affect the damage values given to this gameobject.
When enabled the animal will rotate toward the damage direction
How long the alignment will last
Curve to smooth the trajectory of the alignment
For Animals in which the pivot may be set in the Hip position you can adjust the Rotation Pivot of the alignment with this value:
To Activate a profile, call this function:
MDamageable.Profile_Set(
string
profileName)
To reset to the default values, call:
MDamageable.Profile_Restore();
The damageable can use different profiles to change the way the animal can react to receiving damage.
E.g. You can activate a Profile when the Character has a New Armor, and it changes the way the Damage is done. So the character will receive half the damage.
Or you can change the Profile to Heavy Damage Animations if the Animal is in a Wounded stance.
The name of the profile
All the parameters inside a profile are the same parameters on the MDamageable.
Invoked when the Damageable receives damage. Sends the final value of the Stat modification.
Invoked if the Damage received is Critical.
This is invoked when a Damage is received. Use it to know who did the Damage.
Invoked when receiving elemental damage (Wood, Fire, Ice, Electric etc).