Esempio n. 1
0
        public override void Update()
        {
            if (IsAnimationFinished)
            {
                return;
            }

            if (_currentDisplayImageIndex < _splashScreenContents.Length)
            {
                float dt = (float)Game.UpdateTime.Elapsed.TotalSeconds;
                _fadeTimer.Update(dt);
                var opacity = _currentFadeStep switch
                {
                    FadeStep.FadeIn => _fadeTimer.CompletionValueInDecimal * _fadeTimer.CompletionValueInDecimal,
                    FadeStep.Hold => 1,
                    FadeStep.FadeOut => (1 - _fadeTimer.CompletionValueInDecimal),
                    _ => 0,
                };
                _splashScreenContents[_currentDisplayImageIndex].Opacity = opacity;
                if (_fadeTimer.IsComplete)
                {
                    if (_currentFadeStep < FadeStep.Finished)
                    {
                        _currentFadeStep++;
                        if (_currentFadeStep == FadeStep.Finished)
                        {
                            _currentDisplayImageIndex++;
                            if (_currentDisplayImageIndex >= _splashScreenContents.Length)
                            {
                                _loadingText.Text = "Loading...";
                            }
                            else
                            {
                                _currentFadeStep = FadeStep.FadeIn;
                                _fadeTimer       = CreateFadeTimer(_currentFadeStep);
                            }
                        }
                        else
                        {
                            _fadeTimer = CreateFadeTimer(_currentFadeStep);
                        }
                    }
                }
            }
        }