/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> /// protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); if (inBattle) { battle.update(); //this.IsMouseVisible = battle.mouseVisible; if (battle.battleOver) { inBattle = false; manager.addBlueGold(100); manager.addRedGold(100); manager.returnToManage(Content); } //show victory screen } else if (mIsTitleScreenShown) { UpdateTitleScreen(); if (manager.startBattle) { inBattle = true; } } else { manager.update(Content); if (manager.startBattle) { inBattle = true; map.randomMap(); battle = new TacticalBattle(army1, army2, map, Content); } } base.Update(gameTime); }
/// <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); army1 = new List<Piece>(); army2 = new List<Piece>(); //Load the screen backgrounds mTitleScreenBackground = Content.Load<Texture2D>("Menu/TitleScreen"); //Music musicTitle = Content.Load<Song>("Music/Title"); //Play the Intro Song MediaPlayer.Play(musicTitle); /* army1.Add( new Pikeman("RED", Content)); army2.Add(new Pikeman("BLUE", Content)); army1.Add(new Knight("RED", Content)); army2.Add( new Knight("BLUE", Content)); army1.Add(new Swordsman("RED", Content)); army2.Add(new Swordsman("BLUE", Content)); army1.Add(new Archer("RED", Content)); army2.Add(new Archer("BLUE", Content)); army1.Add(new Nomad("RED", Content)); army2.Add(new Nomad("BLUE", Content)); army1.Add(new Mage("RED", Content)); army2.Add(new Mage("BLUE", Content)); army1.Add(new Zealot("RED", Content)); army2.Add(new Zealot("BLUE", Content)); */ Tile[,] mm = new Tile[30,30]; for (int i = 0; i < 30; i++) for (int j = 0; j < 30; j++) mm[i,j] = new Tile("Plain", i, j); map = new TacMap(mm, Content); map.randomMap(); battle = new TacticalBattle(army1, army2, map, Content); manager = new ArmyManagment(Content, army1, army2); // TODO: use this.Content to load your game content here }