Package de.tum.cit.ase.maze.objects
Class CollectableManager
java.lang.Object
de.tum.cit.ase.maze.objects.CollectableManager
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
Manages collectables like
Collectable or TimedCollectable-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassTask that schedules a respawn by aTimer -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCollectableManager(com.badlogic.gdx.physics.box2d.World world, box2dLight.RayHandler rayHandler, boolean canRespawn) This class manages the collectables in the game. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()com.badlogic.gdx.utils.TimergetTimer()voidrender(com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch) Renders allCollectables.protected final voidSchedules a respawn.final voidspawn(@NonNull Class<? extends Collectable> collectableClass, float areaToCover) SpawnsCollectablesfinal voidspawn(@NonNull Class<? extends Collectable> collectableClass, int amount) SpawnsCollectablesfinal voidspawn(@NonNull Class<? extends Collectable> collectableClass, List<com.badlogic.gdx.math.Vector2> positionList) voidupdate(float dt) Updates the collectables
-
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. SeeGraphics.getDeltaTime()
-
spawn
SpawnsCollectables- Parameters:
collectableClass- the class of theCollectableto spawnamount- amount to spawn
-
render
public void render(com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch) Renders allCollectables.- Parameters:
spriteBatch- theSpriteBatchto render
-
spawn
SpawnsCollectables- Parameters:
collectableClass- the class of theCollectableto spawnareaToCover- 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 therespawn task. -
getTimer
public com.badlogic.gdx.utils.Timer getTimer() -
getRespawnTask
-
dispose
public void dispose()- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-