30 std::lock_guard lock(
_mutex);
36 std::lock_guard lock(
_mutex);
42 std::lock_guard lock(
_mutex);
48 std::lock_guard lock(
_mutex);
54 std::lock_guard lock(
_mutex);
60 std::lock_guard lock(
_mutex);
66 std::lock_guard lock(
_mutex);
72 std::lock_guard lock(
_mutex);
78 std::lock_guard lock(
_mutex);
84 std::lock_guard lock(
_mutex);
90 std::lock_guard lock(
_mutex);
96 std::lock_guard lock(
_mutex);
102 std::lock_guard lock(
_mutex);
108 std::lock_guard lock(
_mutex);
114 std::lock_guard lock(
_mutex);
120 std::lock_guard lock(
_mutex);
126 std::lock_guard lock(
_mutex);
132 std::lock_guard lock(
_mutex);
133 _score = std::max(0, score);
138 std::lock_guard lock(
_mutex);
Player(uint32_t sessionId)
Constructor for Player.
uint32_t _sessionId
Unique player identifier.
uint32_t getId() const
Get the unique identifier of the Session.
void setRoomId(uint32_t roomId)
Set the room ID the player is in.
std::string getUsername() const
Get the username of the player.
void setScore(int score)
Set player's score.
void setWeaponKind(rtp::ecs::components::WeaponKind weapon)
Set the selected weapon kind for this player.
uint32_t _entityId
Associated entity ID in the ECS.
void setState(PlayerState state)
Set the state of the player.
void setReady(bool ready)
Set the readiness status of the player.
uint32_t getRoomId() const
Get the room ID the player is in.
bool isReady() const
Get the readiness status of the player.
void setEntityId(uint32_t entityId)
Set the entity ID associated with the player.
std::string _username
Player username.
uint32_t getEntityId() const
Get the associated entity ID.
bool _isReady
Readiness status of the player.
uint32_t _roomId
ID of the room the player is in ; by default 0 (no room)
void addScore(int delta)
Add to player's score (can be negative)
void setMuted(bool muted)
rtp::ecs::components::WeaponKind getWeaponKind() const
Get the selected weapon kind for this player.
int getScore() const
Get player's score.
void setUsername(const std::string &username)
Set the username of the player.
~Player()
Destructor for Player.
PlayerState _state
Current state of the player.
bool _isMuted
Mute status of the player.
bool isInRoom() const
Check if the player is in a room.
PlayerState getState() const
Get the state of the player.
std::mutex _mutex
Mutex to protect access to player state.
rtp::ecs::components::WeaponKind _weaponKind
Selected weapon.
WeaponKind
Types of player weapons.
File : GameManager.hpp License: MIT Author : Elias Josué HAJJAR LLAUQUEN elias-josue....
PlayerState
Enum representing the state of a player in the session.