Package com.csse3200.game.areas
Interface AreaAPI
- All Known Implementing Classes:
LevelGameArea
,SlotMachineArea
public interface AreaAPI
Interface to inject LevelGameArea into components to safely have access to Entities and
Components
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
beginDrag
(com.badlogic.gdx.graphics.Texture texture) Begins a drag operation with the given texture.default void
Cancels an ongoing drag operation.getGrid()
Gets the game grid for this area.Gets the currently selected unit.float
Gets the size of tiles in this area.boolean
Checks if a character is currently selected.void
removeUnit
(int position) Removes a unit from the specified position.void
setIsCharacterSelected
(boolean selected) Sets the character selection status.void
setSelectedUnit
(Entity unit) Sets the currently selected unit.void
spawnUnit
(int position) Spawns a unit at the specified position.com.badlogic.gdx.math.GridPoint2
stageToWorld
(com.badlogic.gdx.math.GridPoint2 pos) Converts stage to world coordscom.badlogic.gdx.math.GridPoint2
worldToStage
(com.badlogic.gdx.math.GridPoint2 pos) Converts world to stage coords
-
Method Details
-
getGrid
LevelGameGrid getGrid()Gets the game grid for this area.- Returns:
- the level game grid
-
getSelectedUnit
Entity getSelectedUnit()Gets the currently selected unit.- Returns:
- the selected entity, or null if none selected
-
setSelectedUnit
Sets the currently selected unit.- Parameters:
unit
- the entity to select
-
spawnUnit
void spawnUnit(int position) Spawns a unit at the specified position.- Parameters:
position
- the position to spawn the unit at
-
removeUnit
void removeUnit(int position) Removes a unit from the specified position.- Parameters:
position
- the position to remove the unit from
-
getTileSize
float getTileSize()Gets the size of tiles in this area.- Returns:
- the tile size
-
stageToWorld
com.badlogic.gdx.math.GridPoint2 stageToWorld(com.badlogic.gdx.math.GridPoint2 pos) Converts stage to world coords- Parameters:
pos
- the stage coords as GridPoint2- Returns:
- the world coords as GridPoint2
-
worldToStage
com.badlogic.gdx.math.GridPoint2 worldToStage(com.badlogic.gdx.math.GridPoint2 pos) Converts world to stage coords- Parameters:
pos
- the world coords as GridPoint2- Returns:
- the stage coords as GridPoint2
-
beginDrag
default void beginDrag(com.badlogic.gdx.graphics.Texture texture) Begins a drag operation with the given texture.- Parameters:
texture
- the texture to show while dragging
-
cancelDrag
default void cancelDrag()Cancels an ongoing drag operation. -
isCharacterSelected
boolean isCharacterSelected()Checks if a character is currently selected.- Returns:
- true if a character is selected, false otherwise
-
setIsCharacterSelected
void setIsCharacterSelected(boolean selected) Sets the character selection status.- Parameters:
selected
- true to indicate a character is selected, false otherwise
-