public string createState(FSM fsm, string father, string next) { fsm_ = fsm; prefix_ = father; fsm_.addState (prefix_ + ".show", showState(), father); fsm_.addState (prefix_ + ".input", inputState(), father); fsm_.addState (prefix_ + ".over", overState (next), father); return father + ".show"; }
public string createState(FSM fsm, string father, string next) { prefix_ = father; fsm_ = fsm; fsm.addState (prefix_+".input", nomalState (), father); fsm.addState (prefix_+".down", downState (), father); fsm.addState (prefix_+".up", upState (), father); fsm.addState (prefix_+".next", nextState (next), father); return prefix_+".input"; }
public string createState(FSM fsm, string father, string next) { fsm_ = fsm; prefix_ = father; fsm_.addState (prefix_ + ".game", new State(), father); fsm_.addState (prefix_ + ".load", loadState (), father); fsm_.addState (prefix_ + ".play", playState (), father); fsm_.addState (prefix_ + ".input", inputState (), prefix_ + ".play"); fsm_.addState (prefix_ + ".die", dieState (), father); fsm_.addState (prefix_ + ".unload", unloadState (next), father); return father + ".load"; }
//public delegate string NextState(); static public StateWithEventMap Create(TaskFactory creater, FSM fsm, StateWithEventMap.StateAction nextState){ string over = "over" + index_.ToString(); index_++; StateWithEventMap state = new StateWithEventMap (); Task task = null; state.onStart += delegate { task = creater(); TaskManager.PushBack (task, delegate { fsm.post(over); }); TaskManager.Run (task); }; state.onOver += delegate { task.isOver = delegate{ return true; }; }; state.addAction (over, nextState); return state; }
//public delegate string NextState(); static public State Create(TaskFactory creater, FSM fsm, State.StateAction nextState) { string over = "over" + index_.ToString(); index_++; State state = new State(); Task task = null; state.onStart += delegate { task = creater(); TaskManager.PushBack(task, delegate { fsm.post(over); }); TaskManager.Run(task); }; state.onOver += delegate { task.isOver = delegate { return(true); }; }; state.addAction(over, nextState); return(state); }
static public StateWithEventMap Create(TaskFactory creater, FSM fsm, string nextState){ return Create (creater, fsm, delegate { return nextState; }); }
static public State Create(TaskFactory creater, FSM fsm, string nextState) { return(Create(creater, fsm, delegate { return nextState; })); }