FAtomicSpawnParameters
Overview
This struct is used to define the parameters for spawning items atomically. It includes properties such as the actor class, spawn tag, total amount, and limits on the number of items per spawner. The struct also tracks the number of spawned items.
Properties
Type | Name | Access | Description |
|---|---|---|---|
TSubclassOf | ActorClass | EditAnywhere | The class of actor to spawn. |
FName | SpawnTag | EditAnywhere | A tag used to identify which spawners should be used for spawning. |
int32 | TotalAmount | EditAnywhere | The total number of items to spawn. |
bool | bUseMaxAmountPerSpawner | EditAnywhere | Whether to use a maximum amount per spawner. |
int32 | MaxAmountPerSpawner | EditAnywhere | The maximum number of items that can be spawned by a single spawner. |
int32 | MinAmountPerSpawner | EditAnywhere | The minimum number of items that must be spawned by a single spawner. |
bool | bSnapToFloor | EditAnywhere | Whether to snap the spawned actors to the floor. |
int32 | SpawnedAmount | Private | Tracks the number of items that have been spawned so far. |
Functions
Return Type | Signature | Description |
|---|---|---|
void | FAtomicSpawnParameters() | Constructor for the struct, initializing default values. |
ALimenAtomicSpawnManager
Overview
This class extends ALimenGameplayManager and is used to manage the spawning of items atomically. It handles the logic for determining which spawners should be used, how many items each spawner should spawn, and ensuring that the total number of spawned items meets the specified criteria.
Properties
Type | Name | Access | Description |
|---|---|---|---|
TArray | SpawnParameters | EditDefaultsOnly | An array of parameters for atomic item spawning. |
Functions
Return Type | Signature | Description |
|---|---|---|
TArray<AActor*> | SpawnItems(const TArray & ItemParameters) | Spawns items based on the provided parameters and returns an array of spawned actors. |
TArray<AActor*> | SpawnItems() | Spawns items using the default parameters stored in |
TArray< ULimenAtomicSpawner *> | GetItemSpawners(const FName& SpawnerTag) const | Retrieves all active spawners that are compatible with the specified tag. |
int32 | GetAmountToSpawnForSingleSpawner(const FAtomicSpawnParameters& Params) | Determines how many items a single spawner should spawn based on the given parameters. |
int32 | GetTargetItemCount(const TArray & Params) | Calculates the total number of items that need to be spawned based on the provided parameters. |
bool | CanSpawnAllItems(const FAtomicSpawnParameters& Param, const TArray< ULimenAtomicSpawner *>& Spawners) | Checks if all items can be spawned given the current state and constraints. |
Usage & Implementation Notes
This class uses randomization to shuffle both the spawn parameters and spawners for more varied spawning behavior.
It ensures that the total number of spawned items does not exceed the specified limits.
The class relies on
ULimenGlobalRandomStreamUtilsfor shuffling arrays, which must be available in the project.