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(); } }
void AttackEnd() { character.SetState(Character.State.RunningFromEnemy); footRun.SoundStart(); }
// 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(); }