One of the improvements for the melee system in 2.1 is the ability to have input combos start a particular attack. For example, you may only want to play a heavy slashing animation when the player performs a series of inputs such as down, right, down. Or you may want to play a special counter attack after the enemy got a hit on you. These situations can now be accomplished the the Ability Starter.
The Ability Starter is an abstract class that allows you to decide when the ability should start. It can be thought of as being similar to Ability.CanStartAbility with an Automatic start type, except it's generic so you don't have to code the conditions within a specific ability. A new start type of Custom has been created, and when it is set to custom you can select a class that inherits the AbilityStarter class. In version 2.1 we will be shipping an AbilityStarter that will start the ability after an input combo has been performed:
With the above setup the ability will start after the Action, Action, Crouch inputs have been detected with Button Down. If Combo 2 or Combo 3 is not detected within 0.2 seconds from the previous input then the combo will restart. This class is just an example, but the AbilityStarter API gives you full control over when you can start your ability:
C#:
/// <summary>
/// Can the starter start the ability?
/// </summary>
/// <param name="playerInput">A reference to the input component.</param>
/// <returns>True if the starter can start the ability.</returns>
public abstract bool CanInputStartAbility(PlayerInput playerInput);
/// <summary>
/// The ability has started.
/// </summary>
public virtual void AbilityStarted() { }
/// <summary>
/// The ability has stopped running.
/// </summary>
public virtual void AbilityStopped() { }
/// <summary>
/// The object has been destroyed.
/// </summary>
public virtual void OnDestroy() { }