/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { this.spriteBatch = new SpriteBatch(this.GraphicsDevice); this.gameSettings = GameSettings.Load(); this.notificationManager = NotificationManager.Initialize(this.Content, this.spriteBatch, this.screenDimensions); AudioManager.InitializeAndLoad(this.Content); PositionInformer.Initialize(this.Content, new Vector2(this.screenDimensions.X / 2.0f, this.screenDimensions.Y / 2.5f), new Vector2(this.screenDimensions.X / 6.0f), 75, true); this.menuManager.InitializeAndLoad(this.spriteBatch, this.Content, this.gameSettings); this.inputManager.InitializeSpeechEngine(this.menuManager.GetAllSelectableNames()); this.handSprite.InitializeAndLoad(this.spriteBatch, this.Content, ContentLocations.HandIcon); this.headsUpDisplay.InitializeAndLoad(this.spriteBatch, this.Content); EntitySettingsLoader.LoadEntitySettings(this.Content); this.levelManager.LoadContent(this.Content, this.spriteBatch); this.levelEditor.LoadContent(this.spriteBatch, this.Content); this.levelEditor.LevelsCreated = this.gameSettings.TotalCustomLevels; if (SticKart.DisplayColourStream) { this.colourStreamRenderer = new ColourStreamRenderer(this.Content, this.GraphicsDevice); this.colourStreamDisplayArea = new Rectangle(5 * ((int)this.screenDimensions.X / 6), 2 * ((int)this.screenDimensions.Y / 3), (int)this.screenDimensions.X / 6, (int)this.screenDimensions.Y / 3); } AudioManager.PlayBackgroundMusic(this.gameState == GameState.InGame); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { this.spriteBatch.Begin(); SpriteEffects handEffect = this.inputManager.IsActiveHandRight ? SpriteEffects.None : SpriteEffects.FlipHorizontally; switch (this.gameState) { case GameState.InMenu: this.GraphicsDevice.Clear(Color.CornflowerBlue); if (this.menuManager.ActiveMenu == MenuType.Pause) { this.levelManager.Draw(); } this.menuManager.Draw(); if (this.inputManager.HandPosition == Vector2.Zero) { Sprite.Draw(this.handSprite, this.menuManager.HighlightedPosition, 0.0f, Color.White, 1.0f, handEffect, 1.0f); } else { Sprite.Draw(this.handSprite, this.inputManager.HandPosition, 0.0f, Color.White, 1.0f, handEffect, 1.0f); } break; case GameState.InGame: this.GraphicsDevice.Clear(Color.GhostWhite); this.levelManager.Draw(); this.headsUpDisplay.Draw(); break; case GameState.InEditor: this.GraphicsDevice.Clear(Color.GhostWhite); this.levelEditor.Draw(); this.menuManager.Draw(); if (this.inputManager.HandPosition == Vector2.Zero) { Sprite.Draw(this.handSprite, this.menuManager.HighlightedPosition, 0.0f, Color.White, 1.0f, handEffect, 1.0f); } else { if (this.levelEditor.CurrentPositionValid) { Sprite.Draw(this.handSprite, this.inputManager.HandPosition, 0.0f, new Color(0.5f, 1.0f, 0.5f, 0.2f), 1.0f, handEffect, 1.0f); } else { Sprite.Draw(this.handSprite, this.inputManager.HandPosition, 0.0f, new Color(1.0f, 0.5f, 0.5f, 0.2f), 1.0f, handEffect, 1.0f); } } break; default: break; } this.notificationManager.Draw(); if (this.inputManager.PlayerFloorPosition != Vector2.Zero) { PositionInformer.Draw(this.spriteBatch, this.inputManager.PlayerFloorPosition.Y, -1.25f + (this.inputManager.PlayerFloorPosition.X * 0.75f)); } this.spriteBatch.End(); if (SticKart.DisplayColourStream) { this.colourStreamRenderer.Draw(this.spriteBatch, this.colourStreamDisplayArea, 50.0f); } base.Draw(gameTime); }