Class StructureToolPicker
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.components.structures.StructureToolPicker
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable,Renderable,Comparable<Renderable>
This component can be placed onto the player and allows them to select and interact
with structure tools.
-
Field Summary
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate()Adds actors to the stage on creationvoiddraw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draw the renderable.Returns the currently selected tool.voidhide()Hides the tool picker.voidinteract(com.badlogic.gdx.math.GridPoint2 location) Interacts with the currently selected tool.booleanisToolUnlocked(String toolName) Returns the unlocked status as a booleanbooleanReturns whether the tool picker is visible.voidsetSelectedTool(Tool tool) Sets the given tool to be the selected tool.voidshow()Shows the tool picker.voidunlockTool(String toolName) Unlocks a tool, adding it to the structure picker menuMethods inherited from class com.csse3200.game.ui.UIComponent
getLayer, getZIndexMethods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, dispose, overrideZIndex, renderMethods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, updateMethods 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
-
Constructor Details
-
StructureToolPicker
public StructureToolPicker()Creates a new structure tool picker
-
-
Method Details
-
create
public void create()Adds actors to the stage on creation- Overrides:
createin classUIComponent
-
unlockTool
Unlocks a tool, adding it to the structure picker menu- Parameters:
toolName- - the simple name of the tool, e.g. 'Dirt Wall'
-
isToolUnlocked
Returns the unlocked status as a boolean- Parameters:
toolName- - the simple name of the tool, e.g. 'Dirt Wall'- Returns:
- boolean - true if unlocked, false if locked.
-
setSelectedTool
Sets the given tool to be the selected tool.- Parameters:
tool- - the tool to be selected.
-
getSelectedTool
Returns the currently selected tool.- Returns:
- the selected tool.
-
draw
public 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.
-
show
public void show()Shows the tool picker. -
hide
public void hide()Hides the tool picker. -
isVisible
public boolean isVisible()Returns whether the tool picker is visible.- Returns:
- whether the tool picker is visible.
-
interact
public void interact(com.badlogic.gdx.math.GridPoint2 location) Interacts with the currently selected tool.- Parameters:
location- - the location being interacted with.
-