protected virtual void PlayAttackAnimation(Vector3 targetPosition, bool fireAllCanons) { if (_attackAnimators.Count <= 0) { return; } if (fireAllCanons) { _attackAnimators.ForEach(aa => aa.Play()); } else { CustomAnimator animatorToPlay = _attackAnimators.OrderBy(aa => Vector3.Distance(aa.transform.position, targetPosition)).ToList()[0]; animatorToPlay.Play(); } }
protected override void PlayAttackAnimation(Vector3 targetPosition, bool fireAllCanons) { if (_attackAnimators.Count <= 0) { return; } if (fireAllCanons) { _attackAnimators.ForEach(aa => aa.Play()); } else { if (++_shootingIndex >= _attackAnimators.Count) { _shootingIndex = 0; } CustomAnimator animatorToPlay = _attackAnimators[_shootingIndex]; animatorToPlay.Play(); } }