BaseAbilityTemplate - jimdroberts/FishMMO GitHub Wiki

Description

Abstract base ScriptableObject for ability templates, providing common fields and tooltip logic. Used as the foundation for all ability templates in the FishMMO system, supporting configuration of icons, descriptions, requirements, and UI integration.


API Access

Fields

  • public Sprite icon

    The icon representing the ability.

  • public string Description

    Description of the ability.

  • public float ActivationTime

    Time required to activate the ability.

  • public float LifeTime

    Lifetime of the ability effect.

  • public float Speed

    Speed of the ability effect.

  • public float Cooldown

    Cooldown time for the ability.

  • public int Price

    Price or cost of the ability.

  • public AbilityResourceDictionary Resources

    Resources required to use the ability.

  • public AbilityResourceDictionary RequiredAttributes

    Attributes required to use the ability.

  • public FactionTemplate RequiredFaction

    Faction required to use the ability.

  • public ArchetypeTemplate RequiredArchetype

    Archetype required to use the ability.

Properties

  • public string Name

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

  • public Sprite Icon

    The icon representing the ability (property accessor).

Methods

  • public virtual string Tooltip()

    Returns the tooltip string for the ability. Returns:

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

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

    • List combineList: List of tooltips to combine. Returns:
    • string: The tooltip string for the ability.
  • public virtual string GetFormattedDescription()

    Returns the formatted description for the ability. Returns:

    • string: The formatted description for the ability.

Basic Usage

Setup

  1. Inherit from BaseAbilityTemplate to define a new ability template type.
  2. Configure fields such as icon, description, activation time, lifetime, speed, cooldown, price, and requirements in the Unity Inspector or via script.
  3. Integrate with the ability system to use the template for ability instantiation and logic.
  4. Use the tooltip methods to display ability information in the UI.

Example

// Example 1: Creating a Custom Ability Template

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

[CreateAssetMenu(menuName = "FishMMO/Character/Ability/CustomAbility")]
public class CustomAbilityTemplate : BaseAbilityTemplate
{
    // Add custom logic or override base methods here.
}
⚠️ **GitHub.com Fallback** ⚠️