コード例 #1
0
    void Awake()
    {
        _blackBoard = transform.GetComponent <BlackBoard>();

        // 一定要按枚举顺序加入, 以便于按枚举值索引
        AnimFsmStateIdle idleState = new AnimFsmStateIdle(GetComponent <Agent>());

        AddState(idleState);
        AnimFsmStateGoTo gotoState = new AnimFsmStateGoTo(GetComponent <Agent>());

        AddState(gotoState);
        AnimFsmStateCombatMove combatMoveState = new AnimFsmStateCombatMove(GetComponent <Agent>());

        AddState(combatMoveState);
        AnimFsmStateAttackMelee attackMeleeState = new AnimFsmStateAttackMelee(GetComponent <Agent>());

        AddState(attackMeleeState);
        AnimFsmStateInjury injuryState = new AnimFsmStateInjury(GetComponent <Agent>());

        AddState(injuryState);
        AnimFsmStateDeath deathState = new AnimFsmStateDeath(GetComponent <Agent>());

        AddState(deathState);
        AnimFsmStateKnockdown knowdownState = new AnimFsmStateKnockdown(GetComponent <Agent>());

        AddState(knowdownState);
        CurState = DefState = idleState;
    }
コード例 #2
0
ファイル: AnimFsmPlayer.cs プロジェクト: ysguoqiang/samurai
    void Awake()
    {
        _blackBoard = transform.GetComponent <BlackBoard>();

        // 一定要按枚举顺序加入, 以便于按枚举值索引
        AnimFsmStateIdle idleState = new AnimFsmStateIdle(GetComponent <Agent>());

        AddState(idleState);
        AnimFsmStateMove moveState = new AnimFsmStateMove(GetComponent <Agent>());

        AddState(moveState);
        AnimFsmStateRoll rollState = new AnimFsmStateRoll(GetComponent <Agent>());

        AddState(rollState);
        AnimFsmStateAttackMelee attackMeleeState = new AnimFsmStateAttackMelee(GetComponent <Agent>());

        AddState(attackMeleeState);
        AnimFsmStateInjury injuryState = new AnimFsmStateInjury(GetComponent <Agent>());

        AddState(injuryState);
        AnimFsmStateDeath deathState = new AnimFsmStateDeath(GetComponent <Agent>());

        AddState(deathState);

        CurState = DefState = idleState;
    }