MDamager

Overview

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.

This component is not meant to be used on its own

Use MAttack Trigger or MProjectile instead

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.

All these Parameters are found in all the child components. plus some extra new parameters

General

Active

Enable/Disable the Damager.

Index

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.

Hit Layer

Layers to interact with objects. By default, the layer is set that affects only the Animal Layer.

Trigger Interaction

Set the Interaction that the Damager will have with Triggers.

Don't hit Owner

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.

Owner

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.

Damage

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 Modifier

Stat modification to apply on the Damager receiver. for more Info see Modify Stat

Pure Damage

If this parameter is set to true the Damager Receiver (MDamageable) will ignore its default multiplier. Resulting in pure damage.

Critical Damage

The critical damage will apply a chance to increase or decrease the final value of the Stat modifier

Chance

Probability of making a critical damage

Multiplier

The Stat Modifier value will be multiplied by this value if the critical chance is true.

Physics

When a Damager register a collider, it will apply a force to the attached rigidbody.

Force

Amount of force applied

Force Type

Type of force to apply on the ApplyForce() method.

Miscellaneous

React

The Damager receiver will apply its default Animal Reaction

Interact

If the Damage Receiver has any Interactable component it interact with it sending the InteractorID value.

InteractorID

Index to send to the Interactable

Last updated