Package com.csse3200.game.entities
Class EntityIndicator
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.entities.EntityIndicator
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,com.badlogic.gdx.utils.Json.Serializable
,Renderable
,Comparable<Renderable>
A UI component responsible for indicating the direction of an entity which is off-screen
-
Field Summary
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage
-
Constructor Summary
ConstructorsConstructorDescriptionEntityIndicator
(Entity entity) Initialise a new indicator for the given entityEntityIndicator
(Entity entity, String indicatorAssetPath) Initialise a new indicator for the given entity -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Creates the UI and stages the actorsvoid
dispose()
Disposes the indicator from the screenvoid
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draw the renderable.void
update()
Updates the indicator postion on the UIvoid
Calculates where the entity should be positioned along the edge of the screenMethods inherited from class com.csse3200.game.ui.UIComponent
getLayer, getZIndex
Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, render
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, write
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
-
EntityIndicator
Initialise a new indicator for the given entity- Parameters:
entity
- : the entity which will be tracked
-
EntityIndicator
Initialise a new indicator for the given entity- Parameters:
entity
- : the entity which will be trackedindicatorAssetPath
- : path for the indicator asset
-
-
Method Details
-
create
public void create()Creates the UI and stages the actors- Overrides:
create
in classUIComponent
-
update
public void update()Updates the indicator postion on the UI -
updateIndicator
public void updateIndicator()Calculates where the entity should be positioned along the edge of the screen -
draw
public void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Description copied from class:RenderComponent
Draw the renderable. Should be called only by the renderer, not manually.- Specified by:
draw
in classRenderComponent
- Parameters:
batch
- Batch to render to.
-
dispose
public void dispose()Disposes the indicator from the screen- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
- Overrides:
dispose
in classRenderComponent
-