Server Enemy Worker

The ServerEnemyWorker is responsible for managing enemy entities within the game.

Properties

  • public static uint enemyCount: Represents the total count of enemies.

  • public Dictionary<uint, Element> enemies: Represents a collection of enemies.

Constructors

  • public ServerEnemyWorker(): Initializes a new instance of the ServerEnemyWorker, and sets up the enemies dictionary for storing enemy data.

Methods

  • public void AddEnemy(Enemy enemy): Adds a new enemy to the game. It assigns a unique ID to the enemy based on the current value of enemyCount and increments enemyCount after adding the enemy to ensure uniqueness for subsequent enemies.

  • public void RemoveEnemy(uint id): Removes an enemy from the game using its unique ID. If the ID is found in the enemies dictionary, the corresponding enemy is removed.

Last updated