Beispiel #1
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        Fsm = UnityGameFramework.Runtime.GameEntry.GetComponent <FsmComponent>();

        /* 英雄的所有状态类 */
        FsmState <Demo10_HeroLogic>[] heroStates = new FsmState <Demo10_HeroLogic>[] {
            new Demo10_HeroIdleState(),
            new Demo10_HeroWalkState(),
        };

        /* 创建状态机 */
        m_HeroFsm = Fsm.CreateFsm <Demo10_HeroLogic> (this, heroStates);

        /* 启动站立状态 */
        m_HeroFsm.Start <Demo10_HeroIdleState> ();
    }
Beispiel #2
0
    /// <summary>
    /// 初始化状态机
    /// </summary>
    private void InitFSM()
    {
        monsterStateFsm = GameEntry.Fsm.CreateFsm <Monster> ("monsterStateFsm" + this.Id, this, new FsmState <Monster>[] {
            new MonsterCDIdleState(),
            new MonsterAtkCDState(),
        });

        monsterActionFsm = GameEntry.Fsm.CreateFsm <Monster> ("monsterActionFsm" + this.Id, this, new FsmState <Monster>[] {
            new MonsterIdleState(),
            new MonsterWalkState(),
            new MonsterAtkState(),
            new MonsterHurtState(),
            new MonsterDeadState(),
        });

        /* 启动状态机 */
        monsterStateFsm.Start <MonsterCDIdleState> ();
        monsterActionFsm.Start <MonsterIdleState> ();
    }
Beispiel #3
0
    /// <summary>
    /// 初始化状态机
    /// </summary>
    private void InitFSM()
    {
        /* 创建状态机 */
        heroStateFsm = GameEntry.Fsm.CreateFsm <Hero> ("heroStateFsm", this, new FsmState <Hero>[] {
            new HeroCDIdleState(),
            new HeroAtkCDState(),
        });

        heroActionFsm = GameEntry.Fsm.CreateFsm <Hero> ("heroActionFsm", this, new FsmState <Hero>[] {
            new HeroIdleState(),
            new HeroWalkState(),
            new HeroAtkState(),
            new HeroHurtState(),
            new HeroDeadState(),
        });

        /* 启动状态机 */
        heroStateFsm.Start <HeroCDIdleState> ();
        heroActionFsm.Start <HeroIdleState> ();
    }
        protected override void OnShow(object userData)
        {
            base.OnShow(userData);

            Debug.Log("Player已加载");



            // Player状态类
            FsmState <PlayerLogic>[] playerStates = new FsmState <PlayerLogic>[]
            {
                new PlayerIdleState(),
                new PlayerWalkState()
            };

            // 创建状态机
            m_PlayerFsm = GameEntry.Fsm.CreateFsm <PlayerLogic>(this, playerStates);

            // 启动站立状态
            m_PlayerFsm.Start <PlayerIdleState>();
        }