Class EntitySpawn

java.lang.Object
com.csse3200.game.entities.EntitySpawn

public class EntitySpawn extends Object
Computes how many enemies to spawn in the current wave and selects a type per spawn request.
  • Constructor Details

    • EntitySpawn

      public EntitySpawn()
      Creates a new instance with a default per-enemy weight cost.
    • EntitySpawn

      public EntitySpawn(int robotWeight)
      Creates a new instance with a specified per-enemy weight cost. Note: WaveManager must be set separately using setWaveManager().
      Parameters:
      robotWeight - weight cost of a single enemy used to derive spawn counts
    • EntitySpawn

      public EntitySpawn(WaveConfigProvider waveConfigProvider, int robotWeight)
      Test-only constructor allowing injection of a prebuilt WaveConfigProvider to avoid LibGDX file IO in unit tests.
      Parameters:
      waveConfigProvider - provider of wave configuration
      robotWeight - weight cost per enemy
  • Method Details

    • setWaveConfigProvider

      public void setWaveConfigProvider(WaveConfigProvider waveConfigProvider)
      Sets the WaveConfigProvider instance for this EntitySpawn.
      Parameters:
      waveConfigProvider - the WaveConfigProvider instance to use
    • getSpawnCount

      public int getSpawnCount()
      Returns:
      computed spawn count for this wave.
    • spawnEnemies

      public void spawnEnemies()
      Computes spawn count from the current wave's weight budget and minimum requirement configured in JSON.
    • getNextRobotType

      public String getNextRobotType()
      Returns:
      next enemy type from the spawn queue, or "standard" if empty.
    • spawnEnemiesFromConfig

      public void spawnEnemiesFromConfig()
      Builds a spawn queue for the current wave using the new system: - Each wave has a budget (waveWeight). - Each enemy type consumes budget (cost). - Enemies are picked randomly, weighted by 'chance'. - Loop continues until budget runs out.