/// <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> /// Creates the bonuses, obstacles and power ups contained in a level. /// </summary> /// <param name="interactiveEntityDescriptions">A list of interactive entity descriptions.</param> /// <param name="physicsWorld">The physics world to create the entities in.</param> /// <param name="interactiveEntities">An empty list to store the interactive entities in.</param> /// <param name="mineCart">The mine cart entity.</param> /// <param name="cartSwitch">The switch entity.</param> /// <param name="spriteBatch">The sprite batch to use for rendering.</param> /// <param name="contentManager">The game's content manager.</param> public static void CreateInteractiveEntities(List <InteractiveEntityDescription> interactiveEntityDescriptions, ref World physicsWorld, ref List <InteractiveEntity> interactiveEntities, ref MineCart mineCart, ref Switch cartSwitch, SpriteBatch spriteBatch, ContentManager contentManager) { if (interactiveEntities.Count == 0) { foreach (InteractiveEntityDescription description in interactiveEntityDescriptions) { if (EntityConstants.PowerUpNames.Contains(description.Name)) { interactiveEntities.Add(new PowerUp(ref physicsWorld, spriteBatch, contentManager, description, EntitySettingsLoader.GetPowerUpSettings(description.Name))); } else if (EntityConstants.BonusNames.Contains(description.Name) || EntityConstants.ObstacleNames.Contains(description.Name)) { interactiveEntities.Add(new BonusOrObstacle(ref physicsWorld, spriteBatch, contentManager, description, EntitySettingsLoader.GetObstacleOrBonusSetting(description.Name))); } else if (description.Name == EntityConstants.CartBody) { mineCart = new MineCart(spriteBatch, contentManager, ref physicsWorld, description.Position, 100.0f, 240.0f, 350.0f, 80.0f, -80.0f); } else if (description.Name == EntityConstants.Switch) { cartSwitch = new Switch(spriteBatch, contentManager, ref physicsWorld, description.Position, mineCart); } } } }