/// <summary> /// Creates the server-side version of a player /// </summary> /// <param name="username"></param> /// <param name="identifier"></param> /// <param name="uniqueIdentifier"></param> public ServerPlayer(string username, short identifier, long uniqueIdentifier) { UserName = username; Identifier = identifier; ConnectionIdentifier = uniqueIdentifier; CurrentTeam = ServerClientInterface.Team.Spectator; State = ServerClientInterface.PlayerState.Dead; Knife = new ServerWeapon(WeaponData.Weapon.Knife, this); PrimaryWeapon = new ServerWeapon(WeaponData.Weapon.None, this); SecondaryWeapon = new ServerWeapon(WeaponData.Weapon.None, this); CurrentWeapon = Knife; }
/// <summary> /// If the player was dead last round, give them default weapons specific /// to their team /// </summary> public void ResetWeapons() { switch (CurrentTeam) { case ServerClientInterface.Team.CounterTerrorist: SecondaryWeapon = new ServerWeapon(WeaponData.Weapon.Usp, this); break; case ServerClientInterface.Team.Terrorist: SecondaryWeapon = new ServerWeapon(WeaponData.Weapon.Glock, this); break; } CurrentWeapon = Knife; }
/// <summary> /// Sets the weapon of the player /// </summary> /// <param name="weapon"></param> public void SetWeapon(WeaponData.Weapon weapon) { PrimaryWeapon = new ServerWeapon(weapon, this); CurrentWeapon = PrimaryWeapon; }