public PerformTransition ( FsmTransitionId trans ) : void | ||
trans | FsmTransitionId | |
Результат | void |
public void InitialState() { Prototype prototype = new Prototype(); Alpha alpha = new Alpha(); Release release = new Release(); FsmSystem <State> fsm = new FsmSystem <State>(); fsm.AddTransition(prototype, Transitions.Fix, alpha); fsm.AddTransition(alpha, Transitions.Optimize, release); fsm.SetInitialState(prototype); fsm.PerformTransition(Transitions.Fix); fsm.PerformTransition(Transitions.Optimize); Assert.AreEqual(fsm.GetCurrentState(), release); }
void BulletProcess() { EachObject((b) => { b.SetPosition(b.positionI.x + RL.Map.nDir [(int)b.direction, 0], b.positionI.y + RL.Map.nDir [(int)b.direction, 1]); }, RLCharacter.RLTypes.BULLET); OverlapCheck((b, m) => { objects.Remove(m); objects.Remove(b); Destroy(m.gameObject); Destroy(b.gameObject); }, RLCharacter.RLTypes.BULLET, RLCharacter.RLTypes.MONSTER); EachObject((b) => { if (!map.IsOpenTile(b.positionI.x, b.positionI.y)) { objects.Remove(b); Destroy(b.gameObject); } }, RLCharacter.RLTypes.BULLET); fsm.PerformTransition(FsmTransitionId.Complete); }
// helper for the "Reason" method public void PerformTransition(FsmTransitionId trans) { Debug.Log("going to" + trans.ToString()); machine.PerformTransition(trans); }
public void SetTransition(Transition t) { //该方法用来改变有限状态机的状体,有限状态机基于当前的状态和通过的过渡状态。 //如果当前的状态没有用来通过的过度状态,则会抛出错误 fsm.PerformTransition(t); }
//设置状态机状态 public void SetTransition(Transition trans) { fsm.PerformTransition(trans); }