Class PlayerHighlightComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.player.PlayerHighlightComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
Component that renders a highlight on current player cursor position
Is bounded by the maximum "reach" of the player.
Also recognises when it should be muted via listeners.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCreates the component and sets the muted boolean to false -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Creates the component and adds listeners for when the player enters and exits the tractorReturns the path to the textureboolean
isMuted()
Returns the muted booleanvoid
mute()
Mutes the player highlight (OFF)void
unMute()
Unmutes the player highlight (highlight ON)void
update()
Updates player highlightvoid
Updates the position of the player highlight to the current player cursor position Handles translating mouse pos to world pos And "locking" it to the closest tile Indicates which tile the player is currently going to act onMethods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, write
-
Constructor Details
-
PlayerHighlightComponent
public PlayerHighlightComponent()Creates the component and sets the muted boolean to false
-
-
Method Details
-
create
public void create()Creates the component and adds listeners for when the player enters and exits the tractor -
mute
public void mute()Mutes the player highlight (OFF) -
unMute
public void unMute()Unmutes the player highlight (highlight ON) -
isMuted
public boolean isMuted()Returns the muted boolean- Returns:
- true if playerHighlight is muted (highlight is off)
-
updatePosition
public void updatePosition()Updates the position of the player highlight to the current player cursor position Handles translating mouse pos to world pos And "locking" it to the closest tile Indicates which tile the player is currently going to act on -
update
public void update()Updates player highlight -
getTexturePath
Returns the path to the texture- Returns:
- path to texture
-