Class CombatExitDisplay
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.components.combat.CombatExitDisplay
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,Renderable
,Comparable<Renderable>
Displays two buttons during combat to exit the Main Game screen and return to the Main Menu screen.
One button allows for an "instant kill" win, and the other triggers a loss, simulating the player losing the combat.
-
Field Summary
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Initializes the UI component by calling the parent class' create method and adding actors (buttons).void
dispose()
Cleans up the UI component by clearing the table and disposing of resources.void
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) The drawing is handled by the Stage, so no additional drawing logic is needed here.float
Gets the Z-index, which determines the rendering order of this UI component.Methods inherited from class com.csse3200.game.ui.UIComponent
getLayer, setStage
Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, render
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.csse3200.game.rendering.Renderable
render
-
Constructor Details
-
CombatExitDisplay
-
-
Method Details
-
create
public void create()Initializes the UI component by calling the parent class' create method and adding actors (buttons).- Overrides:
create
in classUIComponent
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) The drawing is handled by the Stage, so no additional drawing logic is needed here.- Specified by:
draw
in classRenderComponent
- Parameters:
batch
- the SpriteBatch used for drawing
-
getZIndex
public float getZIndex()Gets the Z-index, which determines the rendering order of this UI component. A higher Z-index indicates that this component will be rendered on top of others.- Specified by:
getZIndex
in interfaceRenderable
- Overrides:
getZIndex
in classUIComponent
- Returns:
- the Z-index of this UI component
-
dispose
public void dispose()Cleans up the UI component by clearing the table and disposing of resources.- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
- Overrides:
dispose
in classRenderComponent
-