MAttack Trigger

Overview

This component is the default damager used with colliders to do damage to the characters.

It requires a collider set as a trigger. By default, it will create a box collider when this component is added to a gameobject.

This component works heavily with the Attack Trigger Behaviour. Which Activate the Attack trigger via Animator Behaviours:

General

Trigger

Reference for the Collider needed by this component. This is a required field*

Active

Enable/Disable the Damager.

Index

Index of the Damager. Often used by the Animator to know which Attack Trigger 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 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.

Damager Profiles

Profiles can change the way an Attack Trigger interacts with any Object. Use this to override values of an Attack Trigger depending the Animation is playing. It can be used to create cool finishing Moves of a Combo attack. The final blow can push the Animal Hitted and it can cause twice the damage:

The values inside the Profiles are the same parameters you can override in the Attack Trigger component.

Use the Index of the Profile to activate it. When the Animation Ends the Profile will be restored and the Default values will be applied on the next Attack Trigger Activation

Damage

When a Damager registers a collider, it will find any MDamageable Component on its hierarchy and it will apply all the modifications necessary to that gameobject

Stat

Which StatID do you want to modify and what do you want to do to it? There are various values in the drop-down.

Min/Max

The minimum and maximum values to modify the stat. If set as the same then it will obviously be a static value.

Pure Damage

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

Element

Type of Element that this Weapon/Attack Trigger can inflict e.g. Fire, Ice, etc.

Chance

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

Multiplier

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

Extras

Min/Max Force

When a Damager registers a collider, it will apply a force to the attached rigidbody. You can set the Min and Max Force here.

Force Mode

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

React

The Damager receiver will apply its default Reaction .

Custom Reaction

You can set your own custom reaction here. This will override the Damager Receiver default reaction.

Interact

If the Damage Receiver has any Interactable component attached it will send an interaction using the InteractorID value.

InteractorID

Index to send to the Interactable.

Hit Effect

This Gameobject will be enabled on impact. If it's a Prefab, it will be instantiated.

Animator Stop Time

Time the Animator will be stopped. If it's zero, stopping the animator is ignored.

Animator Speed

Value of the Animator Speed when it's stopped

Animator

If there's an Animator Controller, it will be stopped

Events

On Hit (Transform)

Invoked when the AttackTrigger hit something. Returns the Damager Receiver Transform as Parameter

On Hit Position (Vector3)

Invoked when the AttackTrigger hit something. Returns the position of the hit on the Damager receiver

On Hit Interactable (int)

Invoked when the Damage Receiver is an Interactable. Returns the Interactable ID as Parameter

On Profile Changed (Int)

Invoked when the damage profile changes

On Attack Begin

Invoked when the Attack Trigger is enabled

On Attack End

Invoked when the Attack Trigger is enabled

Last updated