RegionEntitySpawnerAction - jimdroberts/FishMMO GitHub Wiki

Description

RegionEntitySpawnerAction is a region action ScriptableObject for FishMMO that spawns entities within a region when triggered. The number of entities spawned is determined by the minSpawns and maxSpawns fields. This action is intended to dynamically populate regions with entities, though the actual spawning logic is not yet implemented.


API Access

Fields

  • public int minSpawns

    The minimum number of entities to spawn when this action is triggered.

  • public int maxSpawns

    The maximum number of entities to spawn when this action is triggered.

Methods

  • public override void Invoke(IPlayerCharacter character, Region region, bool isReconciling)

    Spawns entities in the region according to minSpawns and maxSpawns. (Actual spawning logic is not yet implemented.) Parameters: - IPlayerCharacter character: The player character triggering the action. - Region region: The region in which entities will be spawned. - bool isReconciling: Indicates if the action is part of a reconciliation process. Returns: void. No exceptions are thrown.


Basic Usage

Setup

  1. Create a new RegionEntitySpawnerAction ScriptableObject via the Unity Editor (Assets > Create > FishMMO > Region > Region Entity Spawner).
  2. Set the minSpawns and maxSpawns fields in the inspector as needed for your region.
  3. Attach the RegionEntitySpawnerAction to a region definition or trigger as appropriate.

Example

// Example 1: Assigning an entity spawner action to a region
// 1. Create a new RegionEntitySpawnerAction asset in the Unity Editor.
// 2. Set minSpawns and maxSpawns in the inspector.
// 3. Reference this asset in your region setup.

// Example 2: Triggering the action in code
// This is typically handled by the region system, but can be invoked manually for testing.
regionEntitySpawnerAction.Invoke(playerCharacter, region, false);

Best Practices

  • Set minSpawns and maxSpawns to appropriate values to control region population.
  • Implement the actual spawning logic to suit your game's requirements.
  • Document the intended entity types and spawning rules for each region to ensure consistent gameplay.
⚠️ **GitHub.com Fallback** ⚠️