Server Player Worker
The ServerPlayerWorker
class is responsible for managing player entities within the game.
Properties
public static uint playerCount
: Represents the total count of players.public static Dictionary<uint, Element> players
: Represents a collection of players.
Constructors
public ServerPlayerWorker()
: Initializes a new instance of theServerPlayerWorker
and sets up theplayers
dictionary for storing player data.
Methods
public static void AddPlayer(Player player)
: Adds a new player to the game. It assigns a unique ID to the player based on the current value ofplayerCount
and incrementsplayerCount
afterward to ensure uniqueness for future players.public static void RemovePlayer(uint id)
: Removes a player from the game using their unique ID. If the ID exists in theplayers
dictionary, the corresponding player is removed.
Last updated