diff --git a/ogtdglib/src/Effects/Effect.cs b/ogtdglib/src/Effects/Effect.cs index 24cbb96..0c3fb2d 100644 --- a/ogtdglib/src/Effects/Effect.cs +++ b/ogtdglib/src/Effects/Effect.cs @@ -52,7 +52,7 @@ public void Step() /// /// /// - public static Thing Apply(Effect effect) + public static IAutoUpdate Apply(Effect effect) { return new Effector(effect); } diff --git a/ogtdglib/src/Effects/Effector.cs b/ogtdglib/src/Effects/Effector.cs index f9b6590..a47f202 100644 --- a/ogtdglib/src/Effects/Effector.cs +++ b/ogtdglib/src/Effects/Effector.cs @@ -4,7 +4,7 @@ namespace OgtDgLib.Effects { [PublicAPI] - internal sealed class Effector : Thing + internal sealed class Effector : IAutoUpdate { public StateBinding EffectBinding = new StateBinding(nameof(ItsEffect)); public Effect ItsEffect; @@ -12,12 +12,7 @@ internal sealed class Effector : Thing internal Effector(Effect itsEffect) { ItsEffect = itsEffect; - owner = ItsEffect.Owner; - } - - public override void Initialize() - { - Step(); + AutoUpdatables.Add(this); } private void Step() @@ -25,12 +20,10 @@ private void Step() ItsEffect.Step(); } - public override void Update() + public void Update() { if (!ItsEffect.Decayed) - ItsEffect.Step(); - else - Level.Remove(this); + Step(); } } } \ No newline at end of file