Class SlotEffect
java.lang.Object
com.csse3200.game.components.slot.SlotEffect
Slot effects that apply ONLY within LevelGameArea. Supported effects: 1) SUMMON_ENEMY –
Punishment: spawn a wave of enemy robots in the level. 2) DESTROY_ENEMY – Reward : remove
("kill") robot enemies currently present. Design rationale: - LevelGameArea exposes
`spawnRobot(x, y, type)` but does NOT expose a public enemy list, nor does it return the spawned
Entity. Therefore, precise "remove exactly what we spawned" bookkeeping is not possible here
without changing other files. - For DESTROY_ENEMY we use a best-effort approach: iterate over all
registered entities (via EntityService) and unregister those that look like "robots" by a set of
heuristics. This is safe and non-crashing; if the registry is not available, we log and return.
How to integrate: - From SlotEngine, call: SlotEffect.executeByEffect(effect,
levelGameAreaInstance); - This file intentionally has NO dependency on ForestGameArea.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
bindUiContext
(com.badlogic.gdx.scenes.scene2d.Stage stage, com.badlogic.gdx.scenes.scene2d.ui.ScrollPane reelsPane) static void
executeByEffect
(SlotEngine.Effect effect, SlotMachineArea area) Execute a slot effect against a LevelGameArea.static void
-
Method Details
-
bindUiContext
public static void bindUiContext(com.badlogic.gdx.scenes.scene2d.Stage stage, com.badlogic.gdx.scenes.scene2d.ui.ScrollPane reelsPane) -
unbindUiContext
public static void unbindUiContext() -
executeByEffect
Execute a slot effect against a LevelGameArea.- Parameters:
effect
- The effect chosen by the slot engine.area
- The active LevelGameArea (use the current instance; inside LevelGameArea you can pass `this`).
-