Class SpeedBootsUpgrade
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.components.upgrades.SpeedBootsUpgrade
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable,Upgrade,Renderable,Comparable<Renderable>
Manages the Speed Boots Upgrade UI component, handling activation, deactivation,
visual updates, and related sound effects.
when activated, makes player move twice as fast
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]com.badlogic.gdx.scenes.scene2d.ui.Tablecom.badlogic.gdx.scenes.scene2d.ui.ProgressBarcom.badlogic.gdx.scenes.scene2d.ui.Labelstatic final String[]Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage -
Constructor Summary
ConstructorsConstructorDescriptionSpeedBootsUpgrade(CombatStatsComponent combatStatsComponent, KeyboardPlayerInputComponent keyboardPlayerInputComponent) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activates the speed boost if conditions are met (e.g., sufficient gold).voidcreate()Called when the entity is created and registered.voidDeactivates the speed boost, resetting player speed and hiding the UI.voiddispose()Called when the component is disposed.protected voiddraw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draw the renderable.floatlongfloatlongfloatbooleanbooleanbooleanvoidsetStage(com.badlogic.gdx.scenes.scene2d.Stage mock) voidDecrement cost when speed boot is activate.voidupdate()Updates the SpeedBootsUpgrade component each frame, managing the countdown timer and handling deactivation when the boost duration expires.Methods inherited from class com.csse3200.game.ui.UIComponent
getLayer, getZIndexMethods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, renderMethods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.csse3200.game.rendering.Renderable
render
-
Field Details
-
greenTexture
-
whiteBgTexture
-
layout
public com.badlogic.gdx.scenes.scene2d.ui.Table layout -
text
public com.badlogic.gdx.scenes.scene2d.ui.Label text -
speedMeter
public com.badlogic.gdx.scenes.scene2d.ui.ProgressBar speedMeter
-
-
Constructor Details
-
SpeedBootsUpgrade
public SpeedBootsUpgrade() -
SpeedBootsUpgrade
public SpeedBootsUpgrade(CombatStatsComponent combatStatsComponent, KeyboardPlayerInputComponent keyboardPlayerInputComponent)
-
-
Method Details
-
create
public void create()Description copied from class:ComponentCalled when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished.- Overrides:
createin classUIComponent
-
activate
public void activate()Activates the speed boost if conditions are met (e.g., sufficient gold). Deducts the cost, updates player speed, and displays the UI. -
deactivate
public void deactivate()Deactivates the speed boost, resetting player speed and hiding the UI. Cleans up UI elements and resets relevant flags.- Specified by:
deactivatein interfaceUpgrade
-
update
public void update()Updates the SpeedBootsUpgrade component each frame, managing the countdown timer and handling deactivation when the boost duration expires. -
speedCost
public void speedCost()Decrement cost when speed boot is activate. -
dispose
public void dispose()Description copied from class:ComponentCalled when the component is disposed. Dispose of any internal resources here.- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable- Overrides:
disposein classRenderComponent
-
draw
protected void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Description copied from class:RenderComponentDraw the renderable. Should be called only by the renderer, not manually.- Specified by:
drawin classRenderComponent- Parameters:
batch- Batch to render to.
-
setStage
public void setStage(com.badlogic.gdx.scenes.scene2d.Stage mock) - Specified by:
setStagein interfaceRenderable
-
getNormalSpeed
public float getNormalSpeed() -
getBoostedSpeed
public float getBoostedSpeed() -
isActivate
public boolean isActivate() -
isVisible
public boolean isVisible() -
getActiveTimeRemaining
public float getActiveTimeRemaining() -
getBoostDuration
public long getBoostDuration() -
getBoostStartTime
public long getBoostStartTime() -
getPlaySound
public boolean getPlaySound()
-