Exemplo n.º 1
0
        /// <inheritdoc/>
        public void Update(GameTime time)
        {
            switch (_osIntroState)
            {
            case 0:
                _init = new Applications.SystemInitTerminal(_winmgr);
                _init.Show();
                _discord.GameState   = "Peacegate OS version 1.4";
                _discord.GameDetails = "Starting kernel...";
                _osIntroState++;
                break;

            case 1:
                if (_os.PreventStartup == false && (_init.Visible == false || _init.Disposed == true))
                {
                    _osIntroState++;
                }
                break;

            case 2:
                _peacegateIconOpacity += (float)time.ElapsedGameTime.TotalSeconds * 3;
                if (_peacegateIconOpacity >= 1F)
                {
                    _peacegateRide = 0;
                    _osIntroState++;
                    _discord.GameState   = "Peacegate OS version 1.4";
                    _discord.GameDetails = "System initializing.";
                }
                break;

            case 3:
                _peacegateRide += time.ElapsedGameTime.TotalSeconds;
                if (_peacegateRide >= 5)
                {
                    _osIntroState++;
                }
                break;

            case 4:
                _peacegateIconOpacity -= (float)time.ElapsedGameTime.TotalSeconds * 3;
                if (_peacegateIconOpacity <= 0)
                {
                    _osIntroState++;
                }
                break;

            case 5:
                _wgDeskOpen = true;
                var desk = new DesktopWindow(_winmgr);
                desk.Show();
                _desktop      = desk;
                _osIntroState = -1;
                break;

            case 7:
                if (_hackedBgmInstance.Pitch > -1F)
                {
                    _hackedBgmInstance.Pitch = MathHelper.Clamp(_hackedBgmInstance.Pitch - ((float)time.ElapsedGameTime.TotalSeconds * 0.25f), -1, 0);
                }
                else
                {
                    while (_windowSystem.WindowList.Length > 0)
                    {
                        _windowSystem.Close(_windowSystem.WindowList[0].WindowID);
                    }
                    _crash      = _plexgate.New <CrashEntity>();
                    _wgDeskOpen = false;
                    _desktop    = null;
                    _plexgate.GetLayer(LayerType.Foreground).AddEntity(_crash);
                    _hackedBgmInstance.Stop();
                    _hackedBgmInstance.Pitch  = 0;
                    _hackedBgmInstance.Volume = 1;
                    _osIntroState++;
                }
                break;

            case 8:
                if (!_plexgate.GetLayer(LayerType.Foreground).HasEntity(_crash))
                {
                    _crash        = null;
                    _osIntroState = 0;
                }
                break;
            }

            if (_anim == null)
            {
                return;
            }
            if (_anim.IsShowingTutorial)
            {
                _hackedBgmInstance.Volume = MathHelper.Clamp(_hackedBgmInstance.Volume - ((float)time.ElapsedGameTime.TotalSeconds * 3), 0.1F, 1F);
            }
            else
            {
                _hackedBgmInstance.Volume = MathHelper.Clamp(_hackedBgmInstance.Volume + ((float)time.ElapsedGameTime.TotalSeconds), 0.1F, 1F);
            }
            if (_isInConnection)
            {
                if (!_plexgate.GetLayer(LayerType.Foreground).HasEntity(_anim))
                {
                    if (!_plexgate.GetLayer(LayerType.Foreground).HasEntity(_countdown))
                    {
                        _plexgate.GetLayer(LayerType.Foreground).AddEntity(_countdown);
                    }
                }
            }
        }