/// <summary> /// 初始化流程管理器。 /// </summary> /// <param name="fsmManager">有限状态机管理器。</param> /// <param name="procedures">流程管理器包含的流程。</param> public void Initialize(IFsmManager fsmManager, params ProcedureBase[] procedures) { if (fsmManager == null) { throw new GameFrameworkException("FSM manager is invalid."); } m_ProcedureFsm = fsmManager.CreateFsm(this, procedures); }
/// <summary> /// 初始化流程管理器。 /// </summary> /// <param name="fsmManager">有限状态机管理器。</param> /// <param name="procedures">流程管理器包含的流程。</param> public void Register(params ProcedureBase[] procedures) { m_FsmManager = GameFrameEntry.GetModule <FsmManager>(); if (m_FsmManager == null) { throw new GameFrameworkException("FSM manager is invalid."); } m_ProcedureFsm = m_FsmManager.CreateFsm(this, procedures); }
/// <summary> /// 初始化流程管理器。 /// </summary> /// <param name="fsmManager">有限状态机管理器。</param> /// <param name="procedures">流程管理器包含的流程。</param> public void Initialize(IFsmManager fsmManager) { if (fsmManager == null) { Logger.LogError("FSM manager is invalid."); } m_FsmManager = fsmManager; m_ProcedureFsm = m_FsmManager.CreateFsm <IProcedureManager>(this); }
public void Initialize(IFsmManager fsmManager, params ActionBase[] actions) { if (null == fsmManager) { throw new GameFrameworkException("FSM manager is invalid."); } m_fsmManager = fsmManager; m_ActionFsm = m_fsmManager.CreateFsm(this, actions); }
public void Initialize(IFsmManager fsmManager, params ProcessBase[] processs) { if (fsmManager == null) { throw new Exception("FSM manager无效"); } m_FsmManager = fsmManager; m_ProcessFsm = m_FsmManager.CreateFsm(this, processs); }
public void Init(Player player, IFsmManager FSM, params PlayerStateBase[] states) { if (FSM == null) { throw new GameFrameworkException("FSM manager is invalid."); } m_FsmManager = FSM; fsm = m_FsmManager.CreateFsm(player.name.Value, player, states); }
/// <summary> /// 初始化状态管理器 /// </summary> /// <param name="fsmManager">有限状态机管理器.</param> /// <param name="states">状态管理器所包含的状态.</param> public void Initialize(IFsmManager fsmManager, CharacterControllerBase owner, params CharacterStateBase[] states) { if (fsmManager == null) { throw new GameFrameworkException("FSM manager is invalid."); } if (owner == null) { throw new GameFrameworkException("FSM Owner is invalid."); } this.Owner = owner; m_FsmManager = fsmManager; m_StateFsm = m_FsmManager.CreateFsm(this, states); }
/// <summary> /// 初始化流程管理器。 /// </summary> /// <param name="fsmManager">有限状态机管理器。</param> /// <param name="gameStages">流程管理器包含的流程。</param> public StageManager(GameContext context) { var fsmManager = context.GetModule <IFsmManager>(); if (fsmManager == null) { throw new GameException("FSM manager is invalid."); } _fsmManager = fsmManager; var stages = AssemblyCollection .GetTypes() .Where(t => t.IsSubclassOf(typeof(StageBase))) .Select(t => (StageBase)Activator.CreateInstance(t)) .ToArray(); _stageFsm = _fsmManager.CreateFsm(this, stages); }
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); }
/// <summary> /// 创建有限状态机。 /// </summary> /// <typeparam name="T">有限状态机持有者类型。</typeparam> /// <param name="owner">有限状态机持有者。</param> /// <param name="states">有限状态机状态集合。</param> /// <returns>要创建的有限状态机。</returns> public IFsm <T> CreateFsm <T>(T owner, params FsmState <T>[] states) where T : class { return(m_FsmManager.CreateFsm(owner, states)); }