cache non-aim states

This commit is contained in:
in0finite 2021-12-26 23:40:44 +01:00
parent abac2b54f5
commit 7294320ff0

View file

@ -51,6 +51,7 @@ namespace SanAndreasUnity.Behaviours
public StateContainer<Peds.States.BaseScriptState> StateContainer => _stateContainer;
public IReadOnlyList<Peds.States.IAimState> CachedAimStates { get; private set; } = System.Array.Empty<Peds.States.IAimState>();
public IReadOnlyList<Peds.States.BaseScriptState> CachedNonAimStates { get; private set; } = System.Array.Empty<Peds.States.BaseScriptState>();
public Peds.States.BaseScriptState CurrentState { get { return (Peds.States.BaseScriptState) m_stateMachine.CurrentState; } }
@ -154,6 +155,9 @@ namespace SanAndreasUnity.Behaviours
.GetStatesThatInherit<Peds.States.IAimState>()
.Cast<Peds.States.IAimState>()
.ToArray();
this.CachedNonAimStates = _stateContainer.States
.Where(_ => _ is not Peds.States.IAimState)
.ToArray();
this.AwakeForDamage ();