PetAbilityTemplate - jimdroberts/FishMMO GitHub Wiki

Description

ScriptableObject template for defining a pet ability, including prefab and spawn parameters. Inherits from AbilityTemplate and is used to configure pet spawning logic, prefab assignment, and spawn area for pet abilities in the FishMMO system.


API Access

Fields

  • public NetworkObject PetPrefab

    The prefab for the pet to be spawned.

  • public Vector3 SpawnBoundingBox

    The bounding box for spawning the pet.

  • public float SpawnDistance

    The distance from the spawner to spawn the pet.

Methods

  • public override void OnLoad(string typeName, string resourceName, int resourceID)

    Called when the pet ability is loaded. Calculates spawn parameters based on the prefab's collider. Parameters:

    • string typeName: The type name of the ability.
    • string resourceName: The resource name of the ability.
    • int resourceID: The resource ID of the ability.

Basic Usage

Setup

  1. Create a new PetAbilityTemplate asset via the Unity menu: FishMMO/Character/Ability/Pet Ability.
  2. Assign the PetPrefab field to the desired pet NetworkObject prefab.
  3. Configure spawn parameters such as bounding box and distance as needed, or let them be calculated automatically on load.
  4. Integrate with the ability system to use the template for pet spawning logic.

Example

// Example 1: Creating and Configuring a PetAbilityTemplate

// This example demonstrates how to create and configure a PetAbilityTemplate asset
// in Unity, including setting up the pet prefab and spawn parameters.

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