private State sleepState() { StateWithEventMap sleep = new StateWithEventMap (); sleep.addAction("weakup", "move"); return sleep; }
public State inputState() { StateWithEventMap state = new StateWithEventMap (); state.addAction("0", delegate(FSMEvent evt) { if(_ctrl.checkToX(0)){ Time.timeScale =3.0f * _ctrl._speed; _ctrl._toX = 0; } }); state.addAction("1", delegate(FSMEvent evt) { if(_ctrl.checkToX(1)){ Time.timeScale =3.0f * _ctrl._speed; _ctrl._toX = 1; } }); state.addAction("2", delegate(FSMEvent evt) { if(_ctrl.checkToX(2)){ Time.timeScale =3.0f * _ctrl._speed; _ctrl._toX = 2; } }); state.addAction("3", delegate(FSMEvent evt) { if(_ctrl.checkToX(3)){ Time.timeScale =3.0f * _ctrl._speed; _ctrl._toX = 3; } }); return state; }
private State BeginState() { StateWithEventMap state = new StateWithEventMap(); state.onStart += delegate { _view.begin.gameObject.SetActive(true); }; state.onOver += delegate { _view.begin.gameObject.SetActive(false); }; state.addEvent("begin", "input"); return state; }
private State overState() { StateWithEventMap state = new StateWithEventMap (); state.onStart += delegate() { _overCtrl.gameObject.SetActive(true); }; state.onOver += delegate() { _overCtrl.gameObject.SetActive(false); }; return state; }
public State nomalState() { StateWithEventMap state = new StateWithEventMap (); state.addAction ("down", delegate(FSMEvent evt) { return prefix_+".down"; }); state.onStart += delegate() { _score.clear(); _hudText.clear(); }; return state; }
private State weakupState() { StateWithEventMap sleep = new StateWithEventMap (); /*sleep.onStart += delegate() { this.dirver.fire = true; }; sleep.onOver += delegate() { this.dirver.fire = false; };*/ sleep.addAction ("sleep", "sleep"); return sleep; }
private State playState() { StateWithEventMap state = new StateWithEventMap (); state.onStart += delegate() { _playCtrl.gameObject.SetActive(true); }; state.onOver += delegate() { _playCtrl.gameObject.SetActive(false); // BGM.GetInstance().stop(); }; return state; }
private State logoState() { StateWithEventMap state = new StateWithEventMap (); state.onStart += delegate() { _logoCtrl.gameObject.SetActive(true); TempBGM.GetInstance().start(); }; state.onOver += delegate() { _logoCtrl.gameObject.SetActive(false); TempBGM.GetInstance().play(); }; return state; }
private State inputState() { StateWithEventMap play = new StateWithEventMap (); play.addAction ("hurt", delegate(FSMEvent evt) { TempSound.GetInstance().hurt (); this._dirver.hurt(); if(this._dirver.isDie){ return prefix_ + ".die"; } return ""; }); play.onOver += delegate { this._dirver.doDie(); }; return play; }
private State PlayState() { StateWithEventMap state = new StateWithEventMap(); state.onStart += delegate{ TaskWait tw = new TaskWait(2f); TaskManager.PushFront(tw, delegate(){ PlayPanelInit(); }); TaskManager.PushBack(tw, delegate(){ _black.SetBool("On", false); }); TaskManager.Run(tw); }; state.onOver += delegate{ }; state.addEvent("end", "end"); return state; }
//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; }
private State EndState() { StateWithEventMap state = new StateWithEventMap(); state.onStart += delegate{ TaskWait tw = new TaskWait(1.5f); TaskManager.PushBack(tw, delegate(){ _view._endPanel.SetActive(true); for(int i = 0; i < awardList_.Count; ++i){ DestroyImmediate(awardList_[i]); } for(int i = 0; i < enemyList_.Count; ++i){ DestroyImmediate(enemyList_[i]); } for(int i = 0; i < followerList_.Count; ++i){ DestroyImmediate(followerList_[i]); } for(int i = 0; i < rockList_.Count; ++i){ DestroyImmediate(rockList_[i]); } enemyList_.Clear(); followerList_.Clear(); rockList_.Clear(); _endAnimator.SetBool("Play", true); }); TaskManager.Run(tw); }; state.onOver += delegate{ TaskWait tw = new TaskWait(1f); TaskManager.PushFront(tw, delegate(){ _endAnimator.GetComponent<CanvasGroup>().alpha = 0; _endAnimator.SetBool("Play", false); }); TaskManager.PushBack(tw, delegate(){ _view._endPanel.SetActive(false); _endAnimator.GetComponent<CanvasGroup>().alpha = 1; }); TaskManager.Run(tw); }; state.addEvent("again", "again"); return state; }
//public delegate string NextState(); /// <summary> /// 创建一个任务状态 /// </summary> /// <param name="creater">一个返回值为Task的委托</param> /// <param name="fsm">此任务状态所属的状态机</param> /// <param name="nextState">下一个状态</param> /// <returns>带有映射表的状态</returns> 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); }
private State BeginState() { StateWithEventMap state = new StateWithEventMap(); state.onStart += delegate{ _view._beginPanel.SetActive(true); _view._playPanel.SetActive(false); _view._endPanel.SetActive(false); _beginAnimator.SetBool("Go", true); }; state.onOver += delegate{ TaskWait tw = new TaskWait(2f); TaskManager.PushFront(tw, delegate(){ _black.SetBool("On", true); }); TaskManager.PushBack(tw, delegate(){ _view._beginPanel.SetActive(false); _view._playPanel.SetActive(true); }); TaskManager.Run(tw); }; state.addEvent("begin", "play"); return state; }
private State mainState() { StateWithEventMap state = new StateWithEventMap (); return state; }
State idleState() { StateWithEventMap state = new StateWithEventMap (); state.addAction("load", "load"); state.addAction("share", "share"); return state; }
State beginState() { StateWithEventMap state = new StateWithEventMap (); state.onStart += delegate { _ctrl._model.clear(); _ctrl.getNext(); _ctrl._speed = 1.0f; Time.timeScale = _ctrl._speed; _ctrl._view.begin.gameObject.SetActive(true); }; state.onOver += delegate { _ctrl._view.begin.gameObject.SetActive(false); }; state.addEvent("begin", "create"); return state; }
private State playState() { StateWithEventMap play = new StateWithEventMap (); play.addAction ("move", delegate(FSMEvent evt) { this._dirver.move((Vector3)(evt.obj)); }); play.addAction ("control", delegate (FSMEvent evt){ this._level.clickDown(); this._dirver.doControl (); }); play.addAction ("free", delegate (FSMEvent evt){ this._dirver.doFree (); }); return play; }
State playState() { StateWithEventMap state = new StateWithEventMap (); state.onStart += delegate { _ctrl._view.play.gameObject.SetActive(true); _ctrl.refreshModel2View(); }; state.onOver += delegate { _ctrl._view.play.gameObject.SetActive(false); }; return state; }
private State runningState() { //RunningState rs = new RunningState(); StateWithEventMap state = new StateWithEventMap (); state.onStart += delegate { // Debug.Log ("s running"); _trigger.shooting(_gun); }; state.onOver += delegate { //Debug.Log ("e running"); _trigger.close(); }; state.addAction ("hurt", delegate(FSMEvent evt) { Debug.Log ("!hurt"); this.health_--; }); state.addAction("die", "die"); state.addAction("clear", "clear"); return state; }
private State sleepState() { StateWithEventMap state = new StateWithEventMap (); state.addAction ("running", "loading"); return state; }
private State PlayState() { // //创建一个任务状态,任务的执行需要一个任务管理器,在视图界面里建立 // StateWithEventMap state = TaskState.Create(delegate // { // //创建一个等待任务 // TaskWait ts = new TaskWait(); // //等待时间 // ts.setAllTime(3f); // return ts; // }, // fsm, //属于哪个有限状态机 // "end"); //当任务完成时进入的下一个状态 StateWithEventMap state = new StateWithEventMap(); state.onStart += delegate { _view.play.gameObject.SetActive(true); }; state.onOver += delegate { _view.play.gameObject.SetActive(false); }; //RefreshModelToView(); return state; }
//输入状态,在输入开始时显示一个数字 private State InputState() { StateWithEventMap state = new StateWithEventMap(); int number = 0; state.onStart += delegate { number = Random.Range(3, 8); Cube c = _model.GetCube(0, 0); //在0,0位置出现数字 c.number = number; c.isEnable = true; RefreshModelToView(); //每次操作完数据要在界面上画出来 }; //根据状态事件出发某个执行动作 state.addAction("1", delegate(FSMEvent evt) { Input(0,number); return "fall"; //当动作执行完后返回另一个状态,输入为空时返回本状态 }); state.addAction("2", delegate(FSMEvent evt) { Input(1,number); return "fall"; }); state.addAction("3", delegate(FSMEvent evt) { Input(2,number); return "fall"; }); state.addAction("4", delegate(FSMEvent evt) { Input(3,number); return "fall"; }); return state; }
private State EndState() { //带消息映射表的状态类 StateWithEventMap state = new StateWithEventMap(); state.onStart += delegate { _view.end.gameObject.SetActive(true); }; state.onOver += delegate { _view.end.gameObject.SetActive(false); }; state.addEvent("end", "begin"); return state; }
State showState() { StateWithEventMap state = new StateWithEventMap (); state.addAction("back", "unload"); return state; }