Added RecacheMovements() to IMovementController
This commit is contained in:
parent
f0ffc2a8c4
commit
a047be629b
|
@ -8,7 +8,6 @@ namespace Syntriax.Modules.Movement
|
||||||
{
|
{
|
||||||
public class MovementController : MonoBehaviour, IMovementController
|
public class MovementController : MonoBehaviour, IMovementController
|
||||||
{
|
{
|
||||||
|
|
||||||
public IMovement ActiveMovement { get; protected set; } = null;
|
public IMovement ActiveMovement { get; protected set; } = null;
|
||||||
public UnityEvent<IMovement> OnMovementChanged { get; protected set; } = new UnityEvent<IMovement>();
|
public UnityEvent<IMovement> OnMovementChanged { get; protected set; } = new UnityEvent<IMovement>();
|
||||||
|
|
||||||
|
@ -18,7 +17,7 @@ namespace Syntriax.Modules.Movement
|
||||||
protected virtual void Start()
|
protected virtual void Start()
|
||||||
{
|
{
|
||||||
toggleState = GetComponent<IToggleState>();
|
toggleState = GetComponent<IToggleState>();
|
||||||
UpdateMovementCache();
|
RecacheMovements();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void FixedUpdate()
|
protected virtual void FixedUpdate()
|
||||||
|
@ -29,7 +28,7 @@ namespace Syntriax.Modules.Movement
|
||||||
ActiveMovement.ApplyMovement();
|
ActiveMovement.ApplyMovement();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void UpdateMovementCache()
|
public virtual void RecacheMovements()
|
||||||
{
|
{
|
||||||
foreach (IMovement movement in movements)
|
foreach (IMovement movement in movements)
|
||||||
movement.OnTakeOverStateChanged.RemoveListener(OnTakeOverListener);
|
movement.OnTakeOverStateChanged.RemoveListener(OnTakeOverListener);
|
||||||
|
|
|
@ -6,5 +6,7 @@ namespace Syntriax.Modules.Movement
|
||||||
{
|
{
|
||||||
IMovement ActiveMovement { get; }
|
IMovement ActiveMovement { get; }
|
||||||
UnityEvent<IMovement> OnMovementChanged { get; }
|
UnityEvent<IMovement> OnMovementChanged { get; }
|
||||||
|
|
||||||
|
void RecacheMovements();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue