Beispiel #1
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            MusicManager.Update();

            GameMouse.Update(gameTime);
            Camera.Update(gameTime);

            foreach (BaseScreen screen in ScreensToAdd)
            {
                Screens.Add(screen);
            }

            ScreensToAdd.Clear();

            foreach (BaseScreen screen in Screens)
            {
                // Update before handling input - otherwise if we select something the WhileSelected method will be called straightaway, which is usually undesired
                if (screen.Active)
                {
                    screen.Update(gameTime);
                }
            }

            foreach (BaseScreen screen in ScreensToRemove)
            {
                Screens.Remove(screen);
            }

            ScreensToRemove.Clear();
        }
Beispiel #2
0
        public void Begin()
        {
            foreach (BaseScreen baseScreen in ScreensToAdd)
            {
                Screens.Add(baseScreen);
            }

            ScreensToAdd.Clear();
        }
Beispiel #3
0
        public void AddScreen(BaseScreen screen)
        {
            screen.LoadContent(Content);
            screen.Initialize();

            ScreensToAdd.Add(screen);

            if (OnScreenChange != null)
            {
                OnScreenChange(this, EventArgs.Empty);
            }
        }