Exemple #1
0
    public FSMContorl(string contorl_name, IFSMManager manager)
    {
        m_contorl_name = contorl_name;

        m_fsm_manager = manager;

        m_state_pool = m_fsm_manager.InitState();

        IFSMState temp;

        var default_type = m_fsm_manager.GetDefaultStateType();

        if (!m_state_pool.TryGetValue(default_type, out temp))
        {
            throw new System.Exception("'" + m_contorl_name + "' not fount '" + default_type.Name + "' default state");
        }

        Cur_state = temp;

        var mes = new FSMStateMessage();

        mes.LastStateType = null;
        mes.CurStateType  = Cur_state.GetType();

        Cur_state.Enter(mes);
    }
Exemple #2
0
        protected override void Awake()
        {
            base.Awake();

            m_IFSMManager = GameBox.App.Driver.GetModule <IFSMManager>();
            if (null == m_IFSMManager)
            {
                throw new GameBoxFrameworkException("IFSMManager是无效的.");
            }
        }
 private void Awake()
 {
     manager = GetComponent <IFSMManager>();
 }