public override void Update(Zombicide game) { int mapSpeed = 10; game.ActiveCharacter.Update(game); bool moving = Zombie.CheckMoving() || game.ActiveCharacter.moving; //Update UI components life.Text = ("Life: " + (game.ActiveCharacter.DeathThreshold - game.ActiveCharacter.GetDamageTaken()).ToString()); moves.Text = ("Moves Left: " + (game.ActiveCharacter.movesLeft).ToString()); level.Text = ("Level: " + (game.ActiveCharacter.Level).ToString()); experience.Text = ("Experience: " + (game.ActiveCharacter.Experience).ToString()); if ((Weapon)game.ActiveCharacter.MainHandSlot != null) { var mainWeap = (Weapon)game.ActiveCharacter.MainHandSlot; MainHand.Texture = mainWeap.Texture; MainHand.ToolTipText = "Damage: " + mainWeap.Damage + "\nDice: " + mainWeap.Dice + "\nHit Value: " + mainWeap.DiceThreshold + "\nRange: " + mainWeap.MinRange + "-" + mainWeap.MaxRange; MainHand.OutlineColor = (mainWeap.Active) ? Color.Red : Color.White; } else { MainHand.Texture = Character.EmptyHand; MainHand.ToolTipText = null; MainHand.OutlineColor = Color.White; } if ((Weapon)game.ActiveCharacter.OffHandSlot != null) { var offWeap = (Weapon)game.ActiveCharacter.OffHandSlot; OffHand.Texture = offWeap.Texture; OffHand.ToolTipText = "Damage: " + offWeap.Damage + "\nDice: " + offWeap.Dice + "\nHit Value: " + offWeap.DiceThreshold + "\nRange: " + offWeap.MinRange + "-" + offWeap.MaxRange; OffHand.OutlineColor = (offWeap.Active) ? Color.Red : Color.White; } else { OffHand.Texture = Character.EmptyHand; OffHand.ToolTipText = null; OffHand.OutlineColor = Color.White; } BackPackTab.panel.ClearChildren(); game.ActiveCharacter.Backpack.Remove(null); foreach (Item I in game.ActiveCharacter.Backpack) { if (I != null) { Image img = new Image(I.Texture, new Vector2(I.Size.X, I.Size.Y), anchor: Anchor.AutoInline); BackPackTab.panel.AddChild(img); img.OnClick = (Entity i) => { moveItemPopup(img); }; } } //Check endgame conditions if (EndGameFlag == false) { if (game.ActiveCharacter.IsAlive == false) { EndGamePopup(false); } else if (Objective.ObjectiveList.Exists(x => x.flipped == true && x.UndersideColor == "blue")) { EndGamePopup(true); } } if (PopupFlag == false && LastPopupFlag == false && moving == false) { if (game.PreviousMouseState.LeftButton == ButtonState.Pressed && game.MouseState.LeftButton == ButtonState.Released) { MouseClicked(game, 1); } if (game.PreviousMouseState.RightButton == ButtonState.Pressed && game.MouseState.RightButton == ButtonState.Released) { MouseClicked(game, 2); } if (Keyboard.GetState().IsKeyDown(Keys.Space) && whosTurn == MoveState.PlayerTurn) { SearchPopup(); } } LastPopupFlag = PopupFlag; int mapCenterX = mapX + (mapWidth / 2); int mapCenterY = mapY + (mapHeight / 2); if (Keyboard.GetState().IsKeyDown(Keys.Up) && mapCenterY > 0) { mapY -= mapSpeed; } if (Keyboard.GetState().IsKeyDown(Keys.Left) && mapCenterX > 400) { mapX -= mapSpeed; } if (Keyboard.GetState().IsKeyDown(Keys.Right) && mapCenterX < game.GraphicsDevice.Viewport.Width - 400) { mapX += mapSpeed; } if (Keyboard.GetState().IsKeyDown(Keys.Down) && mapCenterY < game.GraphicsDevice.Viewport.Height) { mapY += mapSpeed; } tileHeight = mapHeight / tilesHigh; tileWidth = mapWidth / tilesWide; foreach (Zombie Z in Zombie.zombieList) { Z.Update(game); } if (whosTurn == MoveState.PlayerTurn && moving == false) { applyMoveTiles(game); if (game.ActiveCharacter.movesLeft <= 0) { whosTurn = MoveState.ZombieTurn; } } if (whosTurn == MoveState.ZombieTurn) { //Give zombies their move foreach (Zombie Z in Zombie.zombieList) { if (game.ActiveCharacter.PlayerTile.row == Z.ZombieTile[0] && game.ActiveCharacter.PlayerTile.column == Z.ZombieTile[1]) { Z.attackPlayer(); } else { Z.Move(tileData, game.ActiveCharacter); } } //Spawn new Zombies foreach (var ST in Zombie.SpawnTiles) { if (RNG.Next(0, 2) == 1) { ZombieFactory.Spawn(game.ActiveCharacter.Level, ST[0], ST[1]); } } whosTurn = MoveState.PlayerTurn; game.ActiveCharacter.ResetMoves(moves); } }