Melee Attacks
Melee Attacks require a cohesion between several important aspects of design in order to deliver a fluid, functional experience.
The Animator Controller
Animations
WeaponMeleeAttackDataDefinitionsProdigyAgentEquipmentcomponentIDamageableinterface
Animator Controller

The Controller will transition to the 1H Melee Attacks block when the equipment type matches and the fire input is flagged. Upon doing so, the state of the input determines if the combo will continue or exit. This is handled by a series of separated states.

The Attack state is where the attack occurs, and the transitions branch to either the "exit" state or the next combo in the sequence. If Fire input is true when the input is evaluated for the transition then the next attack state will be chosen, however if the input is not true then it will go to the exit state instead and no further combo attacks can be executed.
In practice this means if you hold the button down then your animations will flow as a fluid combo, but if you release then the attack will exit at the next opportunity and not execute the next attack in the sequence.
Pay close attention to your Animation Events to make sure that they align with your transitions - otherwise you might exit the state before the "Occur" event fires, meaning it would not be able to apply damage.
Pay close attention to your transitions in the animator. You'll need to adjust these to get smooth results in combos. Animations exiting prematurely will appear very jarring and generally feel broken.
You should extend this Controller to include more of these combo blocks as needed for your project.
Animations

Animations should have events to callback and talk to the Equipment component. If they aren't there, then the attack will perpetually lock the character in an undefined "attacking" state because the Animation did not communicate when it started, occurred, or ended the attack. The Equipment class requires this information in order to function properly.
AnimCallbackAttackBegin(int id)
Set internal operational flags, spawn VFX
AnimCallbackAttackOccur(int id)
"Fire" the weapon, eg sweep for hits at this exact moment and apply damage to valid hits
AnimCallbackAttackEnd()
Revert internal operational flags
Add Event Callbacks to all of your melee attack animations.
WeaponMeleeAttackData Definitions
WeaponMeleeAttackData Definitions
The Vault Dashboard allows you to design these parameterized data classes in order to make Melee Attacks perform in a parametric way. You'll configure the sweep size, set the VFX prefabs, set the base damage amount, and any impact force that the weapon might apply during this attack.
ProdigyAgentEquipment component
ProdigyAgentEquipment componentWhen AnimCallbackAttackOccur is called from the Animation Event, the Fire() function will then tell the equipped weapon to perform it's designed response. In the WeaponMelee class for example, a damage sweep using it's design parameters is performed. Any valid IDamageable targets are hurt at this time.
You can override these behaviors and implement your own designs to do unique things when firing melee weapons and handling combos.
Last updated
Was this helpful?