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 the ServerPlayerWorker and sets up the players 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 of playerCount and increments playerCount 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 the players dictionary, the corresponding player is removed.

Last updated