Package com.csse3200.game.components
Class PowerupComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.PowerupComponent
Represents a power-up component within the game.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionPowerupComponent(PowerupType type) Assigns a type and targetLayer value to a given Powerup -
Method Summary
Modifier and TypeMethodDescriptionvoidApplies the effects of the Powerup to the specified target entity.voidcreate()Overrides the Component create() functionlongRetrieves the duration for which the Powerup effect should last.getType()Retrieves the type of the Powerup.voidsetDuration(long duration) Sets the duration for which the Powerup effect should last.voidsetType(PowerupType type) Sets the type of the Powerup.Methods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
PowerupComponent
Assigns a type and targetLayer value to a given Powerup
-
-
Method Details
-
create
public void create()Overrides the Component create() function -
applyEffect
public void applyEffect()Applies the effects of the Powerup to the specified target entity. -
setDuration
public void setDuration(long duration) Sets the duration for which the Powerup effect should last.- Parameters:
duration- Duration in milliseconds.
-
getDuration
public long getDuration()Retrieves the duration for which the Powerup effect should last.- Returns:
- Duration in milliseconds.
-
getType
Retrieves the type of the Powerup.- Returns:
- The current Powerup type.
-
setType
Sets the type of the Powerup.- Parameters:
type- The type to set.
-