Skip to content

🎁 Pickups — Decorators • Creators

Folder: Runtime/Systems/Pickups/Decorators/Creators

This folder contains the creator layer used by the pickup effect factory to construct decorator instances from definition data.

Creators transform definition data into runtime decorator instances by wrapping an existing PickupEffect.


🎯 Purpose

The Creators layer separates authoring data from runtime instances.

It is responsible for:

  • mapping DecoratorType to concrete decorator implementations
  • constructing decorator instances from definitions
  • enabling extension through registration rather than modification

Creators are not part of runtime gameplay execution.


📦 Folder Overview

This folder provides:

  • factory-facing construction logic
  • deterministic decorator creation
  • registry-driven extension support

🧩 What Lives Here

  • IPickupDecoratorCreator → creator contract
  • built-in creator implementations for each decorator type

🧠 Usage Guidance

Creator Contract

public interface IPickupDecoratorCreator
{
    bool CanHandle(DecoratorType type);
    PickupEffect Create(PickupEffect baseEffect, PickupEffectDefinitionBase def);
}

A creator is responsible for:

  • identifying supported decorator types
  • instantiating the correct decorator
  • assigning wrappedEffect
  • copying relevant values from the definition

Creators should not:

  • execute gameplay logic
  • access scene state
  • perform reflection

Factory Integration

Creators are used by PickupEffectFactory.

Construction flow:

  1. read decorator definitions
  2. sort by ascending priority
  3. resolve a creator for each entry
  4. wrap the effect in sequence
  5. return the outermost effect

Ordering:

  • lower priority wraps first
  • higher priority becomes outermost

Registry Behaviour

DefaultPickupDecoratorRegistry provides the default creator set.

  • creators are deduplicated by runtime type
  • resolution scans from newest to oldest
  • later registrations take precedence

Registry control:

PickupEffectFactory.RegisterCreator(...)
PickupEffectFactory.UnregisterCreator(...)
PickupEffectFactory.SetRegistry(...)

🧪 Diagnostics

Built-in creators construct decorators using definition data only.

Runtime behaviour of the resulting decorators depends on:

  • provided definition values
  • available components at execution time

⚠️ Important Notes

  • creators only perform construction, not execution
  • decorator behaviour is defined in decorator implementations, not creators
  • missing creators result in skipped decorator entries

🚫 Not for Production Use

This folder is not intended for:

  • gameplay logic
  • runtime execution behaviour
  • direct scene interaction

It is a construction layer for decorators.


  • Decorators
  • Core
  • Definitions