Пример #1
0
 /// <summary>
 /// 添加从任意状态到另一个状态的转换
 /// </summary>
 /// <param name="to">下一个状态</param>
 /// <param name="predicate">状态转换的条件函数</param>
 public void AddAnyTransition(AbstractState to, Func <bool> predicate)
 {
     _anyTransitions.Add(new Transition(to, predicate));
 }
Пример #2
0
 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="startState">初始状态</param>
 public void Initialize(AbstractState startState)
 {
     CurrentState = startState;
     CurrentState.Enter();
 }
Пример #3
0
 /// <summary>
 /// 构造器
 /// </summary>
 /// <param name="to">下一个状态</param>
 /// <param name="condition">状态转换的条件函数</param>
 public Transition(AbstractState to, Func <bool> condition)
 {
     this.To        = to;
     this.Condition = condition;
 }