/// <summary> /// Main draw cycle. Calls other drawers. /// </summary> public void CallDraws(Minijam32 game, SpriteBatch batch, GraphicsDevice graphicsDevice) { graphicsDevice.Clear(backgroundDirtColor); batch.Begin(samplerState: SamplerState.PointClamp); if (screenState == ScreenState.Start) { this.menuGui.Draw(game, batch); } else if (screenState == ScreenState.Playing) { if (PlayerDataManager.isDead) { this.SetStateToDeath(); } if (game.levelData.hasCompletedLastLevel) { screenState = ScreenState.FinishedGame; game.musicPlayer.Mute(); SoundPlayer.PlaySound(SoundPlayer.Type.NextLevelLick); } game.levelData.DrawBelow(game, batch); PlayerDrawer.DrawCurrentState(batch, PlayerDataManager.tilePosition); game.levelData.DrawAbove(game, batch); Animator.DrawFieldAnimations(batch); InfoDrawer.Draw(batch); } else if (screenState == ScreenState.SwitchingLevel) { this.newLevelDrawer.DrawNextLevelIntro(batch); } else if (screenState == ScreenState.DeadGameOver) { game.levelData.DrawBelow(game, batch); PlayerDrawer.DrawCurrentState(batch, PlayerDataManager.tilePosition); game.levelData.DrawAbove(game, batch); Animator.DrawFieldAnimations(batch); this.newLevelDrawer.DrawDeathScene(batch); } else if (screenState == ScreenState.FinishedGame) { game.levelData.DrawBelow(game, batch); PlayerDrawer.DrawCurrentState(batch, PlayerDataManager.tilePosition); game.levelData.DrawAbove(game, batch); Animator.DrawFieldAnimations(batch); this.finishedGameDrawer.DrawGameCompletedScene(game, batch); } batch.End(); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); TileDrawer.InitAssets(this); PlayerDrawer.InitAssets(this); EnemyDrawer.LoadAssets(this); screenPool = new ScreenPool(this); this.musicPlayer = new MusicPlayer(this); SoundPlayer.InitAssets(this); Animator.InitAssets(this); InfoDrawer.LoadAssets(this); }