コード例 #1
0
        protected override void OnStart()
        {
            base.OnStart();

            ProcedureBase[] procedures = new ProcedureBase[m_AvailableProcedureTypeNames.Length];
            for (int i = 0; i < m_AvailableProcedureTypeNames.Length; i++)
            {
                Type procedureType = AssemblyUtil.GetType(m_AvailableProcedureTypeNames[i]);
                if (procedureType == null)
                {
                    Log.Error("Can not find procedure type '{0}'.", m_AvailableProcedureTypeNames[i]);
                    return;
                }

                procedures[i] = (ProcedureBase)Activator.CreateInstance(procedureType);
                if (procedures[i] == null)
                {
                    Log.Error("Can not create procedure instance '{0}'.", m_AvailableProcedureTypeNames[i]);
                    return;
                }

                if (m_EntranceProcedureTypeName == m_AvailableProcedureTypeNames[i])
                {
                    m_EntranceProcedure = procedures[i];
                }
            }

            if (m_EntranceProcedure == null)
            {
                Log.Error("Entrance procedure is invalid.");
                return;
            }

            //要在Start时候初始化
            m_ProcedureManager.Init(procedures);
            m_ProcedureManager.StartProcedure(m_EntranceProcedure.GetType());
        }
コード例 #2
0
 /// <summary>
 /// 切换状态
 /// </summary>
 /// <param name="state"></param>
 public void ChangeState(ProcedureBase state)
 {
     m_ProcedureManager.ChangeState(state);
 }
コード例 #3
0
 /// <summary>
 /// 切换状态
 /// </summary>
 /// <param name="state"></param>
 public void ChangeState(ProcedureBase state)
 {
     m_CurrFsm.ChangeState(state.GetType());
 }