/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); SceneController.LoadContent(Content, Window); UIMapController.UiMapReaderinitializer(spriteBatch, Window, Content); PlayerController.Font = Content.Load <SpriteFont>("myFont"); InptController.initialize(PlayerController.Font); textures = new Texture2D[3]; textures[0] = Content.Load <Texture2D>("grass"); textures[1] = Content.Load <Texture2D>("water"); textures[2] = Content.Load <Texture2D>("path"); towerTextures = new Texture2D[1]; towerTextures[0] = Content.Load <Texture2D>("Enemy"); projectileTexture = towerTextures[0]; enemyTextures = new Texture2D[1]; enemyTextures[0] = Content.Load <Texture2D>("Enemy"); mapNames = XmlReader.GetNames(); interactableMenu = new InteractableMenu(mapNames, Content.Load <SpriteFont>("myFont")); tileHelpMenu = XmlReader.GetHelpMenu(spriteBatch, PlayerController.Font, "TileHelpMenu"); gameHelpMenu = XmlReader.GetHelpMenu(spriteBatch, PlayerController.Font, "GameHelpMenu"); // TODO: use this.Content to load your game content here }
/// <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) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); //checks which game state the game currently is in. switch (SceneController.CurrentState) { case SceneController.State.LevelPicker: if (nameChosen && !helpMenuActive) { UIMapController.UIMapReaderUpdate(gameTime); } else if (!helpMenuActive) { InptController.MapUDrawpdate(spriteBatch); } if (helpMenuActive) { tileHelpMenu.Draw(spriteBatch); } break; case SceneController.State.HighScore: if (mapHasBeenSelected && !helpMenuActive) { selectedMap.DrawMap(spriteBatch, textures); if (!hasBeenCalledd) { WaveController.Initilazie(selectedMap.PathPoints, enemyTextures); PlayerController.Initalize(spriteBatch); UITowerController.Initilalize(towerTextures, projectileTexture); hasBeenCalledd = true; } WaveController.Update(spriteBatch); PlayerController.draw(spriteBatch); TowerController.Update(gameTime, spriteBatch); } else if (!helpMenuActive) { interactableMenu.Draw(spriteBatch); } if (helpMenuActive) { gameHelpMenu.Draw(spriteBatch); } break; case SceneController.State.Quit: this.Exit(); break; default: SceneController.MenuDraw(spriteBatch); break; } spriteBatch.End(); // TODO: Add your drawing code here base.Draw(gameTime); }