Class MinimapService

java.lang.Object
com.csse3200.game.services.MinimapService
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable

public class MinimapService extends Object implements com.badlogic.gdx.utils.Disposable
Service to hold the state of tracked entities for 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

      public void setDisplay(MinimapDisplay minimapDisplay)
      Sets the minimap display (to which entities are added).
    • getDisplay

      public MinimapDisplay getDisplay()
      Gets the minimap display.
      Returns:
      The minimap display (to which entities are added).
    • trackEntity

      public void trackEntity(Entity entity, com.badlogic.gdx.scenes.scene2d.ui.Image marker)
      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

      public void stopTracking(Entity entity)
      Stops tracking an entity on the minimap.
      Parameters:
      entity - The entity to stop tracking.
    • setMarker

      public void setMarker(Entity entity, com.badlogic.gdx.scenes.scene2d.ui.Image marker)
      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

      public void setMarkerColor(Entity entity, com.badlogic.gdx.graphics.Color color)
      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

      public Map<Entity,com.badlogic.gdx.scenes.scene2d.ui.Image> 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 interface com.badlogic.gdx.utils.Disposable