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. When the Ability Start Type of Custom is selected a dropdown will appear that allows you to select a class that inherits the AbilityStarter class.

Combo Timeout is a class that implements the Ability Starter class. In this example the ability will start after the Action and Fire1 inputs have been detected with a Button Down. If Fire1 is not detected within 0.2 seconds from the Action input then the combo will reset. This is a relatively simple example but the Ability Starter gives you full control over when you can start your ability.

/// <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()