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 TypeMethodDescriptionvoidcreate()Creates the UI and stages the actorsvoiddispose()Disposes the indicator from the screenvoiddraw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draw the renderable.voidupdate()Updates the indicator postion on the UIvoidCalculates where the entity should be positioned along the edge of the screenMethods 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, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, writeMethods 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
-
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:
createin 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:RenderComponentDraw the renderable. Should be called only by the renderer, not manually.- Specified by:
drawin classRenderComponent- Parameters:
batch- Batch to render to.
-
dispose
public void dispose()Disposes the indicator from the screen- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable- Overrides:
disposein classRenderComponent
-