Beispiel #1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            SideBar.Update();
            //  Clouds.Update(gameTime);
            TouchInput.Update(gameTime);
            MouseInput.Update(gameTime);
            UnifiedInput.Update(gameTime);
            KeyboardInput.Update(gameTime);

            UpdateFaders(gameTime);
            MenuMap.Update(gameTime);
            Arena.Update(gameTime);
            Sprites.Update(gameTime);
            Sounds.Update();
            base.Update(gameTime);
        }
Beispiel #2
0
 /// <summary>
 ///     Allows the game to run logic such as updating the world,
 ///     checking for collisions, gathering input, and playing audio.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 protected override void Update(GameTime gameTime)
 {
     if (IsPaused)
     {
         PauseArena.Update(gameTime);
         return;
     }
     Starfield.Update(gameTime);
     if (!ApplicationView.GetForCurrentView().IsFullScreenMode)
     {
         ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
     }
     TouchInput.Update(gameTime);
     MouseInput.Update(gameTime);
     UnifiedInput.Update(gameTime);
     KeyboardInput.Update(gameTime);
     Arena.Update(gameTime);
     Sprites.Update(gameTime);
     base.Update(gameTime);
 }
Beispiel #3
0
        protected async override void Update(GameTime gameTime)
        {
            if (IsPaused)
            {
                return;
            }
            Touch.Update(gameTime);
            Mouse.Update(gameTime);
            UnifiedInput.Update(gameTime);
            KeyboardInput.Update(gameTime);
            //TODO Update Code

            foreach (var backgroundParticle in _backgroundParticles)
            {
                backgroundParticle.Update(gameTime);
            }


            if (_fade1Xin)
            {
                FadeX1 += 0.025f;
                if (FadeX1 >= 1f)
                {
                    _fade1Xin = false;
                }
            }
            else
            {
                FadeX1 -= 0.025f;
                if (FadeX1 <= .5f)
                {
                    _fade1Xin = true;
                }
            }
            if (_fade2Xin)
            {
                FadeX2 += 0.05f;
                if (FadeX2 >= 1f)
                {
                    _fade2Xin = false;
                }
            }
            else
            {
                FadeX2 -= 0.05f;
                if (FadeX2 <= 0.5f)
                {
                    _fade2Xin = true;
                }
            }

            if ((_currentComponent ?? this).Transition >= 1f)
            {
                NextComponent = (_currentComponent ?? this).Update(gameTime, this);
            }

            if (_currentComponent != null)
            {
                _currentComponent.Transition += 0.05f;
                if (_currentComponent.HasPrevious && _taps.Any(t => new Rectangle((int)Width - 64, 0, 64, 64).Contains(t)))
                {
                    Audio.Play(Cues.Fail);
                    _currentComponent.Back();
                }


                if (_currentComponent.HasPrevious && KeyboardInput.TypedKey(Keys.Escape))
                {
                    Audio.Play(Cues.Fail);
                    _currentComponent.Back();
                }
            }
            if (_previousComponent != null)
            {
                _previousComponent.Transition -= 0.05f;
            }

            if (NextComponent != null && NextComponent != _currentComponent)
            {
                GameData.Save();
                _previousComponent = _currentComponent;
                _currentComponent  = NextComponent;
            }

            _taps.Clear();
            base.Update(gameTime);
        }
Beispiel #4
0
        protected async override void Update(GameTime gameTime)
        {
            if (IsPaused)
            {
                return;
            }
            if (NextComponent == null)
            {
                NextComponent = new MainMenu(this, null, Color.White);
            }
            if (_currentComponent.Transition >= 1)
            {
                TouchInput.Update(gameTime);
                MouseInput.Update(gameTime);
                UnifiedInput.Update(gameTime);
                KeyboardInput.Update(gameTime);
            }

            if (_fade1Xin)
            {
                FadeX1 += 0.025f;
                if (FadeX1 >= 1f)
                {
                    _fade1Xin = false;
                }
            }
            else
            {
                FadeX1 -= 0.025f;
                if (FadeX1 <= .5f)
                {
                    _fade1Xin = true;
                }
            }
            if (_fade2Xin)
            {
                FadeX2 += 0.05f;
                if (FadeX2 >= 1f)
                {
                    _fade2Xin = false;
                }
            }
            else
            {
                FadeX2 -= 0.05f;
                if (FadeX2 <= 0.5f)
                {
                    _fade2Xin = true;
                }
            }

            if ((_currentComponent ?? this).Transition >= 1f)
            {
                NextComponent = (_currentComponent ?? this).Update(gameTime, this);
            }

            if (_currentComponent != null)
            {
                _currentComponent.Transition += 0.05f;
                if (EnableGoBack)
                {
                    if (_currentComponent.HasPrevious &&
                        _taps.Any(t => new Rectangle((int)Width - 64, 0, 64, 64).Contains(t)))
                    {
                        //Audio.Play(Cues.Fail);
                        _currentComponent.Back();
                    }


                    if (_currentComponent.HasPrevious && KeyboardInput.TypedKey(Keys.Escape))
                    {
                        //Audio.Play(Cues.Fail);
                        _currentComponent.Back();
                    }
                }
            }
            if (_previousComponent != null)
            {
                _previousComponent.Transition -= 0.05f;
            }

            if (NextComponent != null && NextComponent != _currentComponent)
            {
                GameData.Save();
                _previousComponent = _currentComponent;
                _currentComponent  = NextComponent;
            }

            _taps.Clear();
            base.Update(gameTime);
        }