Package com.csse3200.game.services
Class MinimapService
java.lang.Object
com.csse3200.game.services.MinimapService
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
Service to hold the state of tracked entities for the minimap.
-
Constructor Summary
ConstructorsConstructorDescriptionMinimapService
(com.badlogic.gdx.graphics.Texture minimapTexture, com.badlogic.gdx.math.Vector2 textureTopRight, com.badlogic.gdx.math.Vector2 textureBottomLeft) Creates a new minimap service. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Gets the minimap display.com.badlogic.gdx.graphics.Texture
Gets the texture to use for the minimap background.com.badlogic.gdx.math.Vector2
com.badlogic.gdx.math.Vector2
Gets a read-only view of the currently tracked entities.void
setDisplay
(MinimapDisplay minimapDisplay) Sets the minimap display (to which entities are added).void
Updates the marker on the minimap with a new drawable.void
setMarkerColor
(Entity entity, com.badlogic.gdx.graphics.Color color) Tints the marker on the minimap with a new color.void
stopTracking
(Entity entity) Stops tracking an entity on the minimap.void
trackEntity
(Entity entity, com.badlogic.gdx.scenes.scene2d.ui.Image marker) Adds an entity to be tracked on the minimap.
-
Constructor Details
-
MinimapService
public MinimapService(com.badlogic.gdx.graphics.Texture minimapTexture, com.badlogic.gdx.math.Vector2 textureTopRight, com.badlogic.gdx.math.Vector2 textureBottomLeft) Creates a new minimap service.- Parameters:
minimapTexture
- The texture to use for the minimap background.textureTopRight
- Where texture's top right corner would be located in the world.textureBottomLeft
- Where texture's bottom left corner would be located in the world.
-
-
Method Details
-
getMinimapTexture
public com.badlogic.gdx.graphics.Texture getMinimapTexture()Gets the texture to use for the minimap background.- Returns:
- The texture to use for the minimap background.
-
getTextureTopRight
public com.badlogic.gdx.math.Vector2 getTextureTopRight()- Returns:
- The position of texture's top right corner.
-
getTextureBottomLeft
public com.badlogic.gdx.math.Vector2 getTextureBottomLeft()- Returns:
- The position of texture's bottom left corner.
-
setDisplay
Sets the minimap display (to which entities are added). -
getDisplay
Gets the minimap display.- Returns:
- The minimap display (to which entities are added).
-
trackEntity
Adds an entity to be tracked on the minimap.- Parameters:
entity
- The entity to track.marker
- The image to use for the entity's marker.
-
stopTracking
Stops tracking an entity on the minimap.- Parameters:
entity
- The entity to stop tracking.
-
setMarker
Updates the marker on the minimap with a new drawable.- Parameters:
entity
- The entity whose marker to change.marker
- The new drawable for the marker.
-
setMarkerColor
Tints the marker on the minimap with a new color.- Parameters:
entity
- The entity whose marker to change.color
- The new color for the marker.
-
getTrackedEntities
Gets a read-only view of the currently tracked entities.- Returns:
- A map of all entities being tracked and their associated markers.
-
dispose
public void dispose()- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
-