PetAbilityTemplate - jimdroberts/FishMMO GitHub Wiki
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.
-
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.
-
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.
- Create a new
PetAbilityTemplate
asset via the Unity menu: FishMMO/Character/Ability/Pet Ability. - Assign the
PetPrefab
field to the desired pet NetworkObject prefab. - Configure spawn parameters such as bounding box and distance as needed, or let them be calculated automatically on load.
- Integrate with the ability system to use the template for pet spawning logic.
// 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
}