Beispiel #1
0
        public override void Update(GameTime gameTime)
        {
            if (!escapeMenu.IsOpened)
            {
                Player.Update(gameTime);
                Camera.Update(Player.CanMove ? Player.Position : Player.AstralPosition);
                if (Player.Life <= 0)
                {
                    MainGame.GetInstance().SetScreen(new GameOverScreen());
                }

                foreach (Monster entity in Entities.OfType <Monster>())
                {
                    entity.Update(gameTime, Player);
                }

                while (deletedEntities.Count > 0)
                {
                    Entities.Remove(deletedEntities[0]);
                    deletedEntities.RemoveAt(0);
                }

                foreach (WorldEffect worldEffect in WorldEffects)
                {
                    worldEffect.Update(gameTime);
                }

                List <WorldEffect> deletedEffects = new List <WorldEffect>();

                foreach (WorldEffect worldEffect in WorldEffects)
                {
                    if (worldEffect.LifeSpan <= 0)
                    {
                        deletedEffects.Add(worldEffect);
                    }
                }

                while (deletedEffects.Count > 0)
                {
                    WorldEffects.Remove(deletedEffects[0]);
                    deletedEffects.RemoveAt(0);
                }
                Spawn(gameTime);
            }

            foreach (Window win in Windows.ToArray())
            {
                win.Update(gameTime);
            }

            if (KeyboardManager.IsPressed(Keys.F1))
            {
                isShown = !isShown;
            }
            if (KeyboardManager.IsPressed(KeyboardManager.BindedKeys[(int)KeyboardManager.KeysEnum.Escape]))
            {
                ToggleWindow(escapeMenu);
            }
        }
Beispiel #2
0
        public override void Update(GameTime gameTime)
        {
            if (!escapeMenu.IsOpened)
            {
                Player.Update(gameTime);

                foreach (Monster entity in Entities.OfType <Monster>())
                {
                    entity.Update(gameTime, MapFirst.Data, Player);
                }

                while (deletedEntities.Count > 0)
                {
                    Entities.Remove(deletedEntities[0]);
                    deletedEntities.RemoveAt(0);
                }

                foreach (WorldEffect worldEffect in WorldEffects)
                {
                    worldEffect.Update(gameTime);
                }

                List <WorldEffect> deletedEffects = new List <WorldEffect>();

                foreach (WorldEffect worldEffect in WorldEffects)
                {
                    if (worldEffect.LifeSpan <= 0)
                    {
                        deletedEffects.Add(worldEffect);
                    }
                }

                while (deletedEffects.Count > 0)
                {
                    WorldEffects.Remove(deletedEffects[0]);
                    deletedEffects.RemoveAt(0);
                }

                camera.Update(Player.CanMove ? Player.Position : Player.AstralPosition);
                Spawn(gameTime);
            }

            foreach (Window win in Windows.ToArray())
            {
                win.Update(gameTime);
            }

            if (KeyboardManager.IsPressed(Keys.F1))
            {
                isShown = !isShown;
            }
            if (KeyboardManager.IsPressed(Keys.Escape))
            {
                ToggleWindow(escapeMenu);
            }
        }