/// <summary> /// Sets the weapon of a player. Used by the server /// </summary> /// <param name="identifier"></param> /// <param name="weapon"></param> public void SetWeapon(short identifier, byte weapon) { ClientPlayer player = Players.Find(ply => ply.Identifier == identifier); // Play pickup sound PlaySound(player, "pickup"); // Sets the user's current weapon to the selected one player.SetCurrentWeapon(WeaponData.ByteToWeapon(weapon)); }
/// <summary> /// Syncs other players that are connected to the server /// </summary> /// <param name="identifier"></param> /// <param name="username"></param> /// <param name="?"></param> public void SyncPlayer(short identifier, string username, byte team, float posX, float posY, float rot, byte weapon, byte state) { ClientPlayer player = Players.Find(ply => ply.Identifier == identifier); // If the player doesn't currently exist, set up the data and add it to the list if (player == null) { player = new ClientPlayer(username, identifier, driver.Assets); player.SetPosition(new Vector2(posX, posY)); player.SetRotation(rot); player.SetCurrentWeapon(WeaponData.ByteToWeapon(weapon)); player.SetTeam(team); player.SetState(state); Players.Add(player); } }