protected override void Update(GameTime time) { GameTime = time; keyController.Update(); padController.Update(); TransitionScreen.Update(time); Music.Update(); if (!GameVariables.Underground) { Camera.Update(); } GameVariables.Update(time); if (CurrentState != GameState.GameOver && CurrentState != GameState.MainMenu && CurrentState != GameState.GameComplete) { if (CurrentState == GameState.Playing || CurrentState == GameState.End || CurrentState == GameState.Dead) { CollisionDetector.Update(); GameLists.Update(GameTime); for (int i = 0; i < Marios.Count; i++) { Marios[i].Update(GameTime); } HUD.Update(GameVariables.LevelTimer, new Vector2(Camera.Point.X, Camera.Point.Y), GameVariables.LevelNumber); } } base.Update(GameTime); }
protected override void Initialize() { base.Initialize(); GameVariables = new GameVariables(); Marios = new List <IMario>(); GameVariables.LevelNumber = 1; GameVariables.ScreenWidth = GraphicsDevice.Viewport.Width; GameVariables.ScreenHeight = GraphicsDevice.Viewport.Height; Level = new LevelLoader(); StartMainMenu(); HUD = new HUD(GameVariables.LevelTimer); Camera = new Camera(new Point(0, 0)); Music = new Music(); TransitionScreen = new TransitionScreen(); }
protected override void Draw(GameTime time) { GraphicsDevice.Clear(GameVariables.BackgroundColor); SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Camera.Transform); GameLists.Draw(SpriteBatch); for (int i = 0; i < Marios.Count; i++) { Marios[i].Draw(SpriteBatch); } HUD.Draw(SpriteBatch, SpriteFont, Color.White); base.Draw(GameTime); if (CurrentState != GameState.Playing) { if (CurrentState == GameState.MainMenu) { TransitionScreen.Draw(SpriteBatch, SpriteFont, "MainMenu"); } else if (CurrentState == GameState.Paused) { TransitionScreen.Draw(SpriteBatch, SpriteFont, "Paused"); } else if (CurrentState == GameState.GameOver) { TransitionScreen.Draw(SpriteBatch, SpriteFont, "GameOver"); } else if (CurrentState == GameState.Transition) { TransitionScreen.Draw(SpriteBatch, SpriteFont, "Transition"); } else if (CurrentState == GameState.GameComplete) { TransitionScreen.Draw(SpriteBatch, SpriteFont, "GameComplete"); } } SpriteBatch.End(); }