Added RecacheMovements() to IMovementController

This commit is contained in:
Syntriax 2022-03-08 21:28:52 +03:00
parent f0ffc2a8c4
commit a047be629b
2 changed files with 4 additions and 3 deletions

View File

@ -8,7 +8,6 @@ namespace Syntriax.Modules.Movement
{
public class MovementController : MonoBehaviour, IMovementController
{
public IMovement ActiveMovement { get; protected set; } = null;
public UnityEvent<IMovement> OnMovementChanged { get; protected set; } = new UnityEvent<IMovement>();
@ -18,7 +17,7 @@ namespace Syntriax.Modules.Movement
protected virtual void Start()
{
toggleState = GetComponent<IToggleState>();
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);

View File

@ -6,5 +6,7 @@ namespace Syntriax.Modules.Movement
{
IMovement ActiveMovement { get; }
UnityEvent<IMovement> OnMovementChanged { get; }
void RecacheMovements();
}
}