public void update() { Player.move(); Player.CoolDown.addTime(); checkBoders(); if (GameConstants.mouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed) { if (Player.CoolDown.isReload() == true) { Bullet = new Bullet(); Bullet.BulletInfo.teamNumber = Player.PlayerInfo.teamNumber; if (Player.PlayerInfo.Direction == 2) { Bullet.BulletInfo.Speed = -Bullet.BulletInfo.Speed; Bullet.BulletInfo.Position = new Microsoft.Xna.Framework.Vector2(Player.PlayerInfo.Position.X + 7, Player.PlayerInfo.Position.Y + 15); } else { Bullet.BulletInfo.Position = new Microsoft.Xna.Framework.Vector2(Player.PlayerInfo.Position.X + 31, Player.PlayerInfo.Position.Y + 15); } Player.CoolDown.clear(); } } Camera.Update(Player.PlayerInfo.Position); }
public void recievePlayersListInfo() { while (true) { var recievedPacket = (PacketFromServer)Sockets.recieveUDPMeassage(); List<Player> players = new List<Player>(); lock (IpPort.locker) { stringTable.Clear(); } for (int i = 0; i < recievedPacket.PlayersInfo.Count; i++) { Player player = new Player(); player.PlayerInfo = recievedPacket.PlayersInfo[i]; // players.Add(player); lock (IpPort.locker) { stringTable.Add("Players HP:" + Environment.NewLine); stringTable.Add(player.PlayerInfo.HP + Environment.NewLine); } } GameSession.PlayersList = players; List<Bullet> bullets = new List<Bullet>(); for (int i = 0; i < recievedPacket.BulletInfo.Count; i++) { Bullet bullet = new Bullet(); bullet.BulletInfo = recievedPacket.BulletInfo[i]; bullets.Add(bullet); } GameSession.BulletsList = bullets; } }