Advanced Spawners / AdvancedSpawnerBase

Namespace Playniax.Sequencer

Inherits from SequenceBase

Script can be found in Assets/Playniax/Packages/Advanced Spawners/Scripts (MonoBehaviour)/AdvancedSpawnerBase.cs

Class AdvancedSpawnerBase

Description

The AdvancedSpawnerBase class provides a foundation for creating advanced spawn systems in Unity.
It includes configurable settings for AI, animation, cargo release, child objects, markers, and more.

Public fieldsDescription
GameObject[] prefabs List of prefabs that can be used by the spawner.

Class AdvancedSpawnerBase.AISettings

Description

The AISettings class extends the CruiserSettings from the EnemyAI class and provides additional configuration options
for enabling or disabling AI behavior. It allows you to customize and control the AI's behavior in an advanced spawner setup.

Public fieldsDescription
bool enabled = true Enable or disable AI for spawned objects.

Class AdvancedSpawnerBase.AnimatorSettings

Description

The AnimatorSettings class provides configuration options for controlling the animation behavior of spawned objects.
It allows you to enable or disable animation and optionally set a random frame to start the animation from,
offering flexibility in animation control for advanced spawner setups.

Public fieldsDescription
bool enabled = true Enable or disable the animator for spawned objects.
bool randomFrameStart = true Randomize the starting frame of the animation.

Class AdvancedSpawnerBase.CargoSettings

Description

The CargoSettings class extends CollisionState2D.CargoSettings to manage cargo-related settings for spawned objects.
It includes a ReleaseMode enum that determines how cargo is released (either partially or fully), providing flexibility
in how objects interact with cargo systems during gameplay.

Public fieldsDescription
ReleaseMode releaseMode Mode in which cargo will be released. Choose between 'Half' or 'All'.

Class AdvancedSpawnerBase.ChildSettings

Description

The ChildSettings class defines settings for creating child objects that can be instantiated as part of a parent object.
It includes the prefab to use for the child object, its position, scale, and whether the placement is random.
It also allows overriding collision settings for the child object, offering flexibility in how child objects are managed.

Public fieldsDescription
GameObject prefab Prefab to spawn as a child of the main object.
Vector3 position Position of the child relative to the parent.
float scale = 1 Scale multiplier for the child object.
bool random Whether the child object position should be randomized.

Class AdvancedSpawnerBase.CollisionSettings

Description

The CollisionSettings class defines the collision settings for objects, including whether custom settings should be applied.
It includes a field for setting the structural integrity of the object, allowing fine-tuned control over how objects interact with collisions.

Public fieldsDescription
bool useTheseSettings Whether to use custom collision settings for this object.
float structuralIntegrity = 1 Structural integrity for the object, affecting its durability.

Class AdvancedSpawnerBase.MarkerSettings

Description

The MarkerSettings class allows you to define and customize markers that can be instantiated in the game world.
It includes options for setting the position, scale, color, and collision settings of the marker, as well as the ability to override default visual and structural properties.

Public fieldsDescription
GameObject prefab Prefab to use as a marker for the object.
Vector3 position Position of the marker relative to the parent object.
float scale = 1 Scale multiplier for the marker object.
bool colorOverride Override the color of the marker object.
Color color = Color.white Color to apply to the marker if colorOverride is enabled.

Class AdvancedSpawnerBase.SurpriseSettings

Description

The SurpriseSettings class defines the properties of surprise elements that can be triggered in the game.
It allows you to specify a prefab for the surprise object, set its scale, configure effect settings for its cargo,
and set marker properties like position, scale, and color for additional visual customization.

Public fieldsDescription
GameObject prefab Prefab to use for the surprise cargo.
float scale = 1 Scale multiplier for the surprise cargo.
CollisionState2D.CargoSettings.EffectSettings effectSettings = new CollisionState2D.CargoSettings.EffectSettings() Effect settings to apply to the surprise cargo.
MarkerSettings markerSettings = new MarkerSettings() Settings for the marker associated with the surprise cargo.

AdvancedSpawnerBase is an abstract base class (itself derived from SequenceBase) designed to make it easier to create powerful, customizable spawners for gameplay elements in a sequenced timeline.

It defines a lot of reusable systems like AI, animation, child objects, cargo drops, surprise mechanics, and prefab sorting.

It's not a component you’d use directly, but rather extend from it, like in $FormationSpawner/Introduction$.

Key Features

Here’s a breakdown of each of the internal data containers and features it brings:

AISettings

• Wraps the EnemyAI.CruiserSettings class.
• Adds an enabled toggle so you can optionally apply simple AI to a spawned object.

AnimatorSettings

• Enables animations on spawned objects.
• Optional random frame start for more variety.

CargoSettings

• Inherits from CollisionState2D.CargoSettings.
• Adds a releaseMode:
• Half: Only some objects drop cargo.
• All: Every object drops cargo.

ChildSettings

• Allows adding a child prefab to each spawned object.

Lets you:

• Set its local position and scale.
• Randomize whether it's added or not.
• Override its collision/health settings.