Skip to content

RevFramework – Pickups • Effects

Folder: Runtime/Systems/Pickups/Effects

The Effects folder contains the concrete implementations of PickupEffect.
Each effect is a ScriptableObject that applies gameplay logic when triggered.

✔ Ready-to-use pickup behaviours
✔ Fully modular and decorator-compatible
✔ No hard dependencies on other RevFramework systems
✔ Clean reference implementations for custom effects


🎯 Purpose

Effects exist to:

  • Provide a library of built-in pickup behaviours
  • Demonstrate how to implement effects by subclassing PickupEffect
  • Show clean integration patterns for optional systems like Health, Inventory, and Currency

All effects are authored as ScriptableObjects and executed through the unified effect pipeline.


📦 Built-in Effects (accurate to final code)


❤️ Healing

Effect Description
InstantHealEffect Heals immediately (optional delay). Requires IHealthWriter.
RegenOverTimeEffect Heals repeatedly over time using coroutine ticks. Requires IHealthWriter.

⚠️ HealPickupEffect has been removed (legacy).
Use InstantHealEffect or RegenOverTimeEffect instead.


🛡 Shields

Effect Description
ShieldEffect Applies a temporary shield via ShieldSystem. Supports duration and stacking rules.

🧭 Movement / Animation

Effect Description
TeleportEffect Teleports the actor and optionally clears Rigidbody / Rigidbody2D velocity.
AnimatorTriggerEffect Fires an Animator trigger on the actor.

🎒 Inventory / Economy

Effect Description
GiveItemEffect Grants items using Inventory reflection bridges (InventoryResolve).
GiveCurrencyEffect Grants currency via service resolution, relays, or reflection fallback.

Both effects remain fully decoupled — no assembly references to Inventory or Currency.


✨ Visual / Misc

Effect Description
VfxBurstEffect Spawns a one-shot visual effect.
CompositeEffect Executes multiple effects sequentially.

🚫 Null‑Damageable Support

Effects that do not require an IDamageable must implement:

IEffectAllowsNullDamageable

Correct examples:

  • TeleportEffect
  • VfxBurstEffect
  • GiveCurrencyEffect
  • GiveItemEffect
  • AnimatorTriggerEffect

Any effect that relies only on the context GameObject should implement this marker.

The pipeline checks this via:

effect.AllowsNullDamageable();

🔗 Integration Notes


Health Integration

  • InstantHealEffect and RegenOverTimeEffect require IHealthWriter
  • Dead actors (IHealthReadonly.IsDead) are skipped
  • Shield-related behaviour uses ShieldSystem directly
  • If the Health module is not installed:
  • Effects no‑op safely
  • No exceptions are thrown

Inventory Integration

Used only by GiveItemEffect.

Resolution flow:

  1. Resolve inventory service via:
    InventoryResolve.ServiceFrom(Transform)
    
  2. Construct an ItemStack dynamically via reflection
  3. Invoke:
    GiveExact(GameObject owner, ItemStack stack, string containerKey)
    
  4. If unavailable:
  5. Warn in the Editor
  6. Silent no‑op in builds

Currency Integration

Used only by GiveCurrencyEffect.

Resolution order:

  1. CurrencyResolve.ServiceFrom(Transform)
  2. CurrencyServiceRelay (if present)
  3. Known currency services via reflection fallback

Warnings are Editor‑only; player builds remain silent.


➕ Extending Effects

To write your own effect:

  1. Subclass PickupEffect
  2. Override OnApply(IDamageable target, GameObject context)
  3. Implement IEffectAllowsNullDamageable if health is not required
  4. Add serialized fields for designer control

Example

[CreateAssetMenu(menuName = "RevFramework/Pickups/Effects/Demo")]
public sealed class DemoEffect : PickupEffect, IEffectAllowsNullDamageable
{
    public float magnitude = 1f;

    protected override void OnApply(IDamageable target, GameObject ctx)
    {
        Debug.Log($"Applied demo effect ({magnitude}) to {ctx?.name}");
    }
}

Your effect automatically participates in cooldowns, decorator wrapping, and null‑damageable validation.


📘 See Also

  • Core — effect lifecycle, decorators, cooldowns
  • Definitions — how definitions create effects
  • Decorators — wrapping and extending effect behaviour