예제 #1
0
    public void AttackEnemy()
    {
        if (IsDead())
        {
            return;
        }

        Character targetCharacter = target.GetComponent <Character>();

        if (targetCharacter.IsDead())
        {
            return;
        }
        switch (weapon)
        {
        case Weapon.Bat:
            state = State.RunningToEnemy;
            footRun.SoundStart();
            break;

        case Weapon.Pistol:
            state = State.BeginShoot;
            break;

        case Weapon.Fist:
            state = State.RunningToEnemy;
            footRun.SoundStart();
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }
    }
예제 #2
0
 void AttackEnd()
 {
     character.SetState(Character.State.RunningFromEnemy);
     footRun.SoundStart();
 }
예제 #3
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     footRun.SoundStart();
 }