示例#1
0
    void SetState()
    {
        // DIE
        if (die)
            state = PlayerStates.State.Die;

        // WALK
        if (state == PlayerStates.State.Idle && isWalking)
            state = PlayerStates.State.Walk;

        if (state == PlayerStates.State.Walk && !isWalking)
            state = PlayerStates.State.Idle;

        // ATTACK
        if (state == PlayerStates.State.Idle && isAttacking)
            state = PlayerStates.State.Attack;

        if (state == PlayerStates.State.Walk && isAttacking)
            state = PlayerStates.State.Attack;

        if (state == PlayerStates.State.Attack && !isAttacking)
            state = PlayerStates.State.Idle;
    }
示例#2
0
 void Update()
 {
     currentState = pSM.GetState ();
     Animate ();
 }
示例#3
0
 void Start()
 {
     state = PlayerStates.State.Idle;
 }