AbilityTemplate - jimdroberts/FishMMO GitHub Wiki

Description

ScriptableObject template for defining an ability, including prefabs, triggers, event lists, and requirements. Used to configure all aspects of an ability in the FishMMO system, such as its type, spawn logic, event-driven behaviors, and UI integration.


API Access

Fields

  • public GameObject AbilityObjectPrefab

    The prefab for the ability object (visual or functional representation).

  • public AbilitySpawnTarget AbilitySpawnTarget

    The spawn target type for the ability (where the ability effect appears).

  • public bool RequiresTarget

    Whether the ability requires a target to be used.

  • public byte AdditionalEventSlots

    Additional event slots for the ability (for extensibility).

  • public int HitCount

    The number of times the ability can hit (e.g., for multi-hit abilities).

  • public AbilityType Type

    The type of the ability (e.g., offensive, defensive, utility).

  • public AbilityEvent TargetTrigger

    The event triggered when the ability is activated or hits a target.

  • public List OnTickEvents

    Events executed when the ability object ticks.

  • public List OnHitEvents

    Events executed when the ability object collides or hits a character.

  • public List OnPreSpawnEvents

    Events executed before the primary ability object is spawned.

  • public List OnSpawnEvents

    Events executed when the primary ability object is spawned.

  • public List OnDestroyEvents

    Events executed when the ability object is destroyed.

  • private List cachedAllEventIDs

    Cached list of all event IDs for this ability template.

Methods

  • public List GetAllAbilityEventIDs()

    Returns a cached list of all unique event IDs from all event lists on this template. Returns:

    • List: A list of all unique event IDs used by this ability template.
  • public override string Tooltip()

    Returns the tooltip string for the ability, including its type if set. Returns:

    • string: The tooltip string for the ability.

Basic Usage

Setup

  1. Create a new AbilityTemplate asset via the Unity menu: FishMMO/Character/Ability/Ability.
  2. Assign the ability prefab, configure spawn target, and set up event lists as needed.
  3. Configure ability type, hit count, and any required triggers or event slots.
  4. Integrate with the ability system to ensure the template is used for ability instantiation and logic.

Example

// Example 1: Creating and Configuring an AbilityTemplate

// This example demonstrates how to create and configure an AbilityTemplate asset
// in Unity, including setting up prefabs, event triggers, and ability type.

[CreateAssetMenu(menuName = "FishMMO/Character/Ability/Ability")]
public class FireballAbility : AbilityTemplate
{
    // Configure fields in the Inspector or via script
}
⚠️ **GitHub.com Fallback** ⚠️