Class CollectableManager

java.lang.Object
de.tum.cit.ase.maze.objects.CollectableManager
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable

public class CollectableManager extends Object implements com.badlogic.gdx.utils.Disposable
Manages collectables like Collectable or TimedCollectable
  • Field Details

    • RESPAWN_TIME

      public final float RESPAWN_TIME
      See Also:
    • canRespawn

      public boolean canRespawn
  • Constructor Details

    • CollectableManager

      public CollectableManager(com.badlogic.gdx.physics.box2d.World world, box2dLight.RayHandler rayHandler, boolean canRespawn)
      This class manages the collectables in the game. It handles the spawning, respawning, rendering, and updating of collectables.
  • Method Details

    • update

      public void update(float dt)
      Updates the collectables
      Parameters:
      dt - delta time. See Graphics.getDeltaTime()
    • spawn

      public final void spawn(@NonNull Class<? extends Collectable> collectableClass, int amount)
      Parameters:
      collectableClass - the class of the Collectable to spawn
      amount - amount to spawn
    • render

      public void render(com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch)
      Renders all Collectables.
      Parameters:
      spriteBatch - the SpriteBatch to render
    • spawn

      public final void spawn(@NonNull Class<? extends Collectable> collectableClass, float areaToCover)
      Parameters:
      collectableClass - the class of the Collectable to spawn
      areaToCover - percentage of the area that will be covered
    • spawn

      public final void spawn(@NonNull Class<? extends Collectable> collectableClass, List<com.badlogic.gdx.math.Vector2> positionList)
    • scheduleRespawn

      protected final void scheduleRespawn()
      Schedules a respawn. Called by the respawn task.
    • getTimer

      public com.badlogic.gdx.utils.Timer getTimer()
    • getRespawnTask

      public CollectableManager.RespawnTask getRespawnTask()
    • dispose

      public void dispose()
      Specified by:
      dispose in interface com.badlogic.gdx.utils.Disposable