RevFramework – Pickups • Decorators • Creators¶
Folder: Runtime/Systems/Pickups/Decorators/Creators
The Creators folder contains the builder classes that construct decorators
from DecoratorDefinition records inside a PickupEffectDefinitionBase.
✔ Each creator maps a
DecoratorType→ concretePickupEffectDecorator
✔ Factory builds decorator chains deterministically
✔ Supports custom extension with zero reflection
🎯 Purpose¶
Creators exist to:
- Separate authoring data (definitions) from runtime instances (decorators)
- Provide a clean, registry‑based creation model
- Allow projects to add, replace, or override decorator types safely
Creators are pure construction logic — they contain no runtime gameplay behaviour.
🧩 Core Interface¶
IPickupDecoratorCreator¶
All decorator creators implement this interface:
public interface IPickupDecoratorCreator
{
bool CanHandle(DecoratorType type);
PickupEffect Create(PickupEffect baseEffect, PickupEffectDefinitionBase def);
}
Responsibilities¶
A creator must:
- Declare which
DecoratorTypeit can build - Instantiate the correct
PickupEffectDecorator - Copy configuration values from the definition (
def) - Assign the incoming
baseEffecttowrappedEffect - Return the newly wrapped decorator instance
Creators should never:
- Execute gameplay logic
- Perform reflection
- Query scene state
🏭 Factory Workflow¶
The decorator construction pipeline is fully deterministic:
- A
PickupEffectDefinitionBaselistsDecoratorDefinitionentries PickupEffectFactorysorts them by priority (ascending)- For each decorator entry:
- The registry is queried for a matching creator
- The creator constructs a decorator wrapping the current effect
- The result is a fully chained decorated effect
This guarantees:
- Stable ordering
- No hidden behaviour
- No reflection or runtime discovery
📦 Default Creators¶
The following creators ship with RevFramework:
| Creator Class | Decorator Type | Description |
|---|---|---|
VFXDecoratorCreator |
VFX |
Spawns one‑shot visual effects |
PersistentVFXDecoratorCreator |
PersistentVFX |
Attaches or times a persistent visual effect |
SoundDecoratorCreator |
Sound |
Plays audio via AudioSFXChannel or fallback AudioSource |
ConditionalDecoratorCreator |
Conditional |
Gates execution by health %, tag, or random chance |
DebugLogDecoratorCreator |
DebugLog |
Logs execution in the console (Editor‑safe) |
These are registered automatically by DefaultPickupDecoratorRegistry.
📚 Registry¶
DefaultPickupDecoratorRegistry¶
Handles lookup and lifetime of all decorator creators:
public sealed class DefaultPickupDecoratorRegistry : IPickupDecoratorRegistry
{
void Register(IPickupDecoratorCreator creator);
void Unregister(IPickupDecoratorCreator creator);
IPickupDecoratorCreator Find(DecoratorType type);
}
Important Notes¶
- Built‑in creators are registered during registry construction
- Duplicate creator types are ignored (prevents undefined behaviour)
- The active registry can be replaced entirely:
PickupEffectFactory.SetRegistry(customRegistry);
This allows complete control over decorator availability if required.
➕ Extending the System¶
To add a custom decorator type:
-
Create the decorator class
SubclassPickupEffectDecoratorand implement your behaviour. -
Create a matching creator
ImplementIPickupDecoratorCreatorand map yourDecoratorType. -
Register the creator
PickupEffectFactory.RegisterCreator(new MyCustomDecoratorCreator());
- (Optional) Extend
DecoratorTypewith your new enum value and reference it from your definition asset.
This keeps custom behaviour fully compatible with the factory pipeline and ordering guarantees.
📘 See Also¶
- Decorators Overview —
../ - Core Factory Pipeline —
../../Core/README.md - Effect Definitions —
../../Definitions/README.md