diff --git a/2D/MovementController.cs b/2D/MovementController.cs index 43137f4..379e037 100644 --- a/2D/MovementController.cs +++ b/2D/MovementController.cs @@ -8,7 +8,6 @@ namespace Syntriax.Modules.Movement { public class MovementController : MonoBehaviour, IMovementController { - public IMovement ActiveMovement { get; protected set; } = null; public UnityEvent OnMovementChanged { get; protected set; } = new UnityEvent(); @@ -18,7 +17,7 @@ namespace Syntriax.Modules.Movement protected virtual void Start() { toggleState = GetComponent(); - UpdateMovementCache(); + RecacheMovements(); } protected virtual void FixedUpdate() @@ -29,7 +28,7 @@ namespace Syntriax.Modules.Movement ActiveMovement.ApplyMovement(); } - protected virtual void UpdateMovementCache() + public virtual void RecacheMovements() { foreach (IMovement movement in movements) movement.OnTakeOverStateChanged.RemoveListener(OnTakeOverListener); diff --git a/IMovementController.cs b/IMovementController.cs index 39a53a5..b7f7f85 100644 --- a/IMovementController.cs +++ b/IMovementController.cs @@ -6,5 +6,7 @@ namespace Syntriax.Modules.Movement { IMovement ActiveMovement { get; } UnityEvent OnMovementChanged { get; } + + void RecacheMovements(); } }