Пример #1
0
        private void PlaySound(TurbineAnimationType type)
        {
            switch (type)
            {
            case TurbineAnimationType.Rotate:
            {
                _startAudioCoroutine = StartCoroutine(StartAudioCoroutine());
                break;
            }

            case TurbineAnimationType.Move:
            {
                if (_audioSource != null)
                {
                    _audioSource.PlayOneShot(_disassembleClip);
                }
                break;
            }

            case TurbineAnimationType.StopRotation:
            {
                StopCoroutine(_startAudioCoroutine);
                if (_audioSource != null)
                {
                    _audioSource.Stop();
                    _audioSource.PlayOneShot(_stopClip);
                }
                break;
            }
            }
        }
Пример #2
0
        public void StartAnimations(TurbineAnimationType type)
        {
            if (type != TurbineAnimationType.RevertCutoff)
            {
                _delayedAnimationType = TurbineAnimationType.None;
            }
            switch (SceneState)
            {
            case TurbineState.Default:
                break;

            case TurbineState.Cut:
                if (_currentAnimationType != TurbineAnimationType.StopRotation)
                {
                    _delayedAnimationType = type;
                    type = TurbineAnimationType.StopRotation;
                }
                break;

            case TurbineState.Exploded:
                _delayedAnimationType = type;
                type = TurbineAnimationType.RevertMove;
                break;
            }
            _currentAnimationType = type;
            if (type != TurbineAnimationType.Rotate && type != TurbineAnimationType.None)
            {
                IsAnimating = true;
            }
            AnimationControllers.ForEach(x => x.Play(type));
            PlaySound(type);
        }
Пример #3
0
 private void EndReverseAnimation()
 {
     _currentAnimationType = TurbineAnimationType.None;
     SceneState            = TurbineState.Default;
     if (_delayedAnimationType != TurbineAnimationType.None)
     {
         StartAnimations(_delayedAnimationType);
     }
 }
Пример #4
0
        private void PlaySound(TurbineAnimationType type)
        {
            var audioSource = FindObjectOfType <AudioSource>();

            switch (type)
            {
            case TurbineAnimationType.Rotate:
            {
                _startAudioCoroutine = StartCoroutine(StartAudioCoroutine());
                break;
            }

            case TurbineAnimationType.Move:
            {
                if (audioSource && audioSource.gameObject.activeInHierarchy)
                {
                    audioSource.PlayOneShot(_disassembleClip);
                }
                break;
            }

            case TurbineAnimationType.StopRotation:
            {
                if (_startAudioCoroutine != null)
                {
                    StopCoroutine(_startAudioCoroutine);
                }
                if (audioSource != null && audioSource.gameObject.activeInHierarchy)
                {
                    audioSource.Stop();
                    audioSource.PlayOneShot(_stopClip);
                }
                break;
            }
            }
        }
Пример #5
0
 public virtual void Play(TurbineAnimationType type)
 {
     _isReverse = type == TurbineAnimationType.RevertCutoff || type == TurbineAnimationType.RevertMove || type == TurbineAnimationType.StopRotation;
     GetComponent <Animator>().Play(type.ToString());
 }