Example #1
0
        public AudioMultiFadeState(AudioClipModel clip, params AudioFadeModel[] audioFadeModels)
        {
            Clip = clip;

            _audioFadeModels = audioFadeModels;
            _currentModel    = audioFadeModels[0];
        }
Example #2
0
        public void Tick(float deltaTime)
        {
            _elapsedTime += deltaTime;

            var nextModelIndex = Array.IndexOf(_audioFadeModels, _currentModel) + 1;

            while (_completedDurations + _currentModel.Duration < _elapsedTime)
            {
                if (nextModelIndex < _audioFadeModels.Length)
                {
                    _completedDurations += _currentModel.Duration;
                    _currentModel        = _audioFadeModels[nextModelIndex];
                    nextModelIndex++;
                }
                else
                {
                    break;
                }
            }
        }
Example #3
0
 public AudioFade(AudioClipModel clip, float startVolume, float targetVolume, float duration)
 {
     Clip   = clip;
     _model = new AudioFadeModel(startVolume, targetVolume, duration);
 }