예제 #1
0
 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;
 }
예제 #2
0
        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);
            }
        }
예제 #3
0
 public void SetStateSnapshot(FsmSnapshot snapshot)
 {
     ElapsedTime = snapshot.StateProgress;
     if (snapshot.TransitoinId != -1)
     {
         _activeTransition = _transitions[snapshot.TransitoinId];
         _activeTransition.NormalizedTime = snapshot.TransitionProgress;
     }
     else
     {
         _activeTransition = null;
     }
 }
예제 #4
0
 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);
     }
 }
예제 #5
0
 public void GetFsmSnapshot(FsmSnapshot snapshot)
 {
     _currentState.GetStateSnapshot(snapshot);
 }