Ejemplo n.º 1
0
        public IEnumerator FsmTestWithEnumeratorPasses()
        {
            // Use the Assert class to test conditions.
            // yield to skip a frame

            AshUnityEntry.New();
            IFsmManager fsmManager = AshEntry.GetModule <IFsmManager>();


            FsmOwer fsmOwer = new FsmOwer();
            Status1 status1 = new Status1();
            Status2 status2 = new Status2();

            //fsmManager.CreateFsm<FsmOwer>( fsmOwer, status1, status2);
            fsmManager.CreateFsm <FsmOwer>("Test", fsmOwer, status1, status2);

            Log.Debug("有限状态机的数量时{0}", fsmManager.Count);
            IFsm <FsmOwer> fsm = fsmManager.GetFsm <FsmOwer> ("Test");

            Assert.IsNotNull(fsm);

            VarString v = new VarString();

            v.SetValue("Variable data");             //			v.Value = "Variable data";
            fsm.SetData("data", v);

            fsm.Start <Status1> ();
            Assert.AreEqual(fsm.CurrentState, status1);

            yield return(new WaitForSeconds(1));

            fsm.FireEvent(this, 1, "userData");
//			Assert.AreEqual (fsm.CurrentState, status2);

            yield return(null);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 点击场景,单个建造物品
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void OnEvtClickScene(object sender, GameEventArgs e)
 {
     m_Fsm.FireEvent(this, EvtClick, e);
 }
Ejemplo n.º 3
0
 private void OnEvtEnterBuildEdit(object sender, GameEventArgs e)
 {
     m_Fsm.FireEvent(this, e.Id, e);
 }