AbilityEvent - jimdroberts/FishMMO GitHub Wiki

Description

Abstract base class for ability events, providing common event fields, requirements, and tooltip logic. Used as a foundation for defining specific ability event types in the FishMMO system, supporting configuration of activation, lifetime, speed, cost, requirements, and UI integration.


API Access

Fields

  • private Sprite icon

    The icon representing the ability event (set in the inspector).

  • public float ActivationTime

    Time required to activate the event (in seconds).

  • public float LifeTime

    Lifetime of the event effect (in seconds).

  • public float Speed

    Speed of the event effect (units per second).

  • public float Cooldown

    Cooldown time for the event (in seconds).

  • public int Price

    Price or cost of the event (e.g., in-game currency).

  • public AbilityResourceDictionary Resources

    Resources required to use the event (e.g., mana, stamina).

  • public AbilityResourceDictionary RequiredAttributes

    Attributes required to use the event (e.g., strength, intelligence).

  • public FactionTemplate RequiredFaction

    Faction required to use the event.

  • public ArchetypeTemplate RequiredArchetype

    Archetype required to use the event.

Properties

  • public string Name

    The name of the event (from the ScriptableObject name).

  • public Sprite Icon

    The icon representing the event (property accessor).

Methods

  • public string GetFormattedDescription()

    Returns the formatted description for the ability event. Returns:

    • string: A string describing the ability event.
  • public string Tooltip()

    Returns the tooltip string for the ability event. Returns:

    • string: The tooltip string for the ability event.
  • public string Tooltip(List combineList)

    Returns the tooltip string for the ability event, optionally combining with other tooltips. Parameters:

    • List combineList: List of tooltips to combine. Returns:
    • string: The tooltip string for the ability event.

Basic Usage

Setup

  1. Inherit from AbilityEvent to define a specific ability event type.
  2. Configure fields such as activation time, lifetime, speed, cost, and requirements in the Unity Inspector or via script.
  3. Assign icons and set up resource/attribute requirements as needed.
  4. Integrate with the ability system to trigger events and display tooltips in the UI.

Example

// Example 1: Creating a Custom Ability Event

// This example demonstrates how to create a new ability event by inheriting from AbilityEvent.
// Configure the event's properties and override methods as needed for custom logic.

[CreateAssetMenu(menuName = "FishMMO/Ability/Events/CustomEvent")]
public class CustomAbilityEvent : AbilityEvent
{
    // Add custom logic or override base methods here.
}
⚠️ **GitHub.com Fallback** ⚠️