Server Kingdom Worker
Last updated
Last updated
The ServerKingdomWorker
class is responsible for managing kingdom entities within the game.
Properties
public static uint kingdomCount
: Represents the total count of kingdoms.
public Dictionary<uint, Kingdom> kingdoms
: Represents a collection of kingdoms.
public ServerKingdomWorker()
: Initializes a new instance of the ServerKingdomWorker
and prepares the kingdoms
dictionary for storing kingdom data.
Methods
public void AddPlayer(Kingdom kingdom)
: Adds a new kingdom to the game. It assigns a unique ID to the kingdom based on the current value of kingdomCount
and increments kingdomCount
afterward to ensure uniqueness for future kingdoms.
public void RemovePlayer(uint id)
: Removes a kingdom from the game using its unique ID. If the ID exists in the kingdoms
dictionary, the corresponding kingdom is removed.