From a047be629b27ac39bae4cf752610bae51ffa04e2 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Tue, 8 Mar 2022 21:28:52 +0300 Subject: [PATCH] Added RecacheMovements() to IMovementController --- 2D/MovementController.cs | 5 ++--- IMovementController.cs | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) 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(); } }