コード例 #1
0
 private void RemoveAnimatorFromList(CustomAnimator animator)
 {
     if (_attackAnimators.Contains(animator))
     {
         _attackAnimators.Remove(animator);
     }
 }
コード例 #2
0
 private void AddAnimatorToAvailable(CustomAnimator animator)
 {
     if (!_availableDamageAnimators.Contains(animator))
     {
         _availableDamageAnimators.Add(animator);
     }
 }
コード例 #3
0
 private void RemoveAnimatorFromAvailable(CustomAnimator animator)
 {
     if (_availableDamageAnimators.Contains(animator))
     {
         _availableDamageAnimators.Remove(animator);
     }
 }
コード例 #4
0
        protected virtual void PlayAttackAnimation(Vector3 targetPosition, bool fireAllCanons)
        {
            if (_attackAnimators.Count <= 0)
            {
                return;
            }

            if (fireAllCanons)
            {
                _attackAnimators.ForEach(aa => aa.Play());
            }
            else
            {
                PlayAudioShipShoot();

                CustomAnimator animatorToPlay = _attackAnimators.OrderBy(aa => Vector3.Distance(aa.transform.position, targetPosition)).ToList()[0];
                animatorToPlay.Play();
            }
        }
コード例 #5
0
        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;
                }

                PlayAudioShipShoot();

                CustomAnimator animatorToPlay = _attackAnimators[_shootingIndex];
                animatorToPlay.Play();
            }
        }