From 625bbf5b1ab93b3ceb7c792ffa37d108dfedeb85 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 23 May 2026 19:02:06 +0200 Subject: [PATCH] Feat: Added GameGimmick interface The interface will function as a content replacement option in the Strategy principle. --- .../view/widgets/minigames/GameGimmick.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/GameGimmick.java diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/GameGimmick.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/GameGimmick.java new file mode 100644 index 0000000..e1add25 --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/GameGimmick.java @@ -0,0 +1,30 @@ +package edu.ntnu.idi.idatt2003.g40.mappe.view.widgets.minigames; + +import java.util.function.IntConsumer; +import javafx.scene.Node; + +/** + * Strategy interface defining the central + * logic and layout for individual minigames. + */ +public interface GameGimmick { + + /** + * Getter method for JavaFx root element of this gimmick. + * + * @return This games root as a {@link Node} + */ + Node getCanvasNode(); + + /** + * Initializes the game behavior, wiring score changes back to the engine. + * + * @param scoreModifier Callback function to adjust the global score. + */ + void initialize(IntConsumer scoreModifier); + + /** + * Called on every frame tick (or second) by the main game loop. + */ + void updateTick(); +}