public void GetStateSnapshot(FsmSnapshot snapshot) { snapshot.StateId = StateId; snapshot.StateProgress = ElapsedTime; snapshot.TransitoinId = _activeTransition != null ? _activeTransition.Id : (short)-1; snapshot.TransitionProgress = _activeTransition != null ? _activeTransition.NormalizedTime : -1; }
public void SetFsmSnapshot(FsmSnapshot snapshot) { FsmState fsmState = null; if (_states.TryGetValue(snapshot.StateId, out fsmState)) { if (snapshot.StateId != _currentState.StateId) { if (_states.TryGetValue(snapshot.StateId, out fsmState)) { _currentState = /*_states[snapshot.StateId]*/ fsmState; Logger.DebugFormat("rewind to {0} in {1}", snapshot.StateId, _name); } else { Logger.ErrorFormat("rewind target state not exists: {0} in {1}", snapshot.StateId, _name); } } _currentState.SetStateSnapshot(snapshot); } else { Logger.ErrorFormat("wrong state id {0} in {1}", snapshot.StateId, _name); } }
public void SetStateSnapshot(FsmSnapshot snapshot) { ElapsedTime = snapshot.StateProgress; if (snapshot.TransitoinId != -1) { _activeTransition = _transitions[snapshot.TransitoinId]; _activeTransition.NormalizedTime = snapshot.TransitionProgress; } else { _activeTransition = null; } }
public void SetFsmSnapshot(FsmSnapshot snapshot) { if (_states.ContainsKey(snapshot.StateId)) { if (snapshot.StateId != _currentState.StateId) { if (_states.ContainsKey(snapshot.StateId)) { _currentState = _states[snapshot.StateId]; Logger.DebugFormat("rewind to {0} in {1}", snapshot.StateId, _name); } else { Logger.ErrorFormat("rewind target state not exists: {0} in {1}", snapshot.StateId, _name); } } _currentState.SetStateSnapshot(snapshot); } else { Logger.ErrorFormat("wrong state id {0} in {1}", snapshot.StateId, _name); } }
public void GetFsmSnapshot(FsmSnapshot snapshot) { _currentState.GetStateSnapshot(snapshot); }