Class TimedCollectable
java.lang.Object
de.tum.cit.ase.maze.objects.GameElement
de.tum.cit.ase.maze.objects.still.collectable.Collectable
de.tum.cit.ase.maze.objects.still.collectable.TimedCollectable
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
- Direct Known Subclasses:
DamageDeflect
,SpeedBoost
A
TimedCollectable
is a Collectable
, that applies an effect to the Player
for a specified time. After that the effect is removed.-
Field Summary
Modifier and TypeFieldDescriptionprotected float
Duration of the effect in secondsprotected float
Fields inherited from class de.tum.cit.ase.maze.objects.still.collectable.Collectable
active, frameHeight, frameWidth, light, rayHandler, removable, textureAtlas, textureRegion, ZOOM
Fields inherited from class de.tum.cit.ase.maze.objects.GameElement
body, texture, world
-
Constructor Summary
ConstructorDescriptionTimedCollectable
(com.badlogic.gdx.math.Vector2 position, com.badlogic.gdx.physics.box2d.World world, box2dLight.RayHandler rayHandler, com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
Applies the effect to the player.void
Called when aPlayer
is collects it.void
dispose()
boolean
Float[]
Gets Duration and Elapsed time.int
hashCode()
void
remove()
Removes the collectableabstract void
Restores the changes made byapply(de.tum.cit.ase.maze.objects.dynamic.Player)
toString()
void
update
(float deltaTime) Updates the ObjectMethods inherited from class de.tum.cit.ase.maze.objects.still.collectable.Collectable
createBoy, isActive, isRemovable
Methods inherited from class de.tum.cit.ase.maze.objects.GameElement
render
-
Field Details
-
duration
protected float durationDuration of the effect in seconds -
elapsedTIme
protected float elapsedTIme
-
-
Constructor Details
-
TimedCollectable
public TimedCollectable(com.badlogic.gdx.math.Vector2 position, com.badlogic.gdx.physics.box2d.World world, box2dLight.RayHandler rayHandler, com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas)
-
-
Method Details
-
apply
Applies the effect to the player. The effect is restored byrestore(Player)
- Parameters:
player
- thePlayer
to apply the effect to.
-
restore
Restores the changes made byapply(de.tum.cit.ase.maze.objects.dynamic.Player)
-
getDurationAndElapsed
Gets Duration and Elapsed time.- Returns:
- Array of size 2 with first the elapsed time and the duration;
-
update
public void update(float deltaTime) Description copied from class:GameElement
Updates the Object- Overrides:
update
in classCollectable
- Parameters:
deltaTime
- Time since last frame.
-
collect
Description copied from class:Collectable
Called when aPlayer
is collects it.- Specified by:
collect
in classCollectable
- Parameters:
player
- thePlayer
that collected it
-
remove
public void remove()Description copied from class:Collectable
Removes the collectable- Overrides:
remove
in classCollectable
-
dispose
public void dispose()- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
- Overrides:
dispose
in classCollectable
-
equals
-
hashCode
public int hashCode() -
toString
-