public override void Initialize() { base.Initialize(); _currentDamageState = DamageState.Alive; CurrentMobState = _behavior[_currentDamageState]; CurrentMobState.EnterState(Owner); CurrentMobState.UpdateState(Owner); }
public MobStateChangedMessage( IMobStateComponent component, IMobState?oldMobState, IMobState currentMobState) { Component = component; OldMobState = oldMobState; CurrentMobState = currentMobState; }
public void OnHealthChanged(HealthChangedEventArgs e) { if (e.Damageable.CurrentDamageState != _currentDamageState) { _currentDamageState = e.Damageable.CurrentDamageState; CurrentMobState.ExitState(Owner); CurrentMobState = _behavior[_currentDamageState]; CurrentMobState.EnterState(Owner); } CurrentMobState.UpdateState(Owner); }
public IdleState(IMobState nextState, DateTime?expiry = null) { NextState = nextState; if (expiry != null) { Expiry = expiry.Value; } else { Expiry = DateTime.UtcNow.AddSeconds(MathHelper.Random.Next(5, 15)); } }
public bool TryGetState( int damage, [NotNullWhen(true)] out IMobState?state, out int threshold) { var highestState = GetState(damage); if (highestState == null) { state = default; threshold = default; return(false); } (state, threshold) = highestState.Value; return(true); }
public bool TryGetEarliestIncapacitatedState( int minimumDamage, [NotNullWhen(true)] out IMobState?state, out int threshold) { var earliestState = GetEarliestIncapacitatedState(minimumDamage); if (earliestState == null) { state = default; threshold = default; return(false); } (state, threshold) = earliestState.Value; return(true); }
public void ChangeState(IMobState state) { CurrentState = state; }
public void ChangeState(IMobState state) { CurrentState = state; }