package de.uniks.pmws1920.controller.ingame; public class HouseController { private Consumer houseSelectedCallback; public void setContent(ModelBuilder builder, AnchorPane pane, House house, double xPos, double yPos, Consumer houseSelectedCallback) { // this is new this.houseSelectedCallback = houseSelectedCallback; } // =================================================================================== // Logic // =================================================================================== public ShroomController extractOneShroom() { // return first shroomController out if the list if list is not empty } public void handleEnemyArrives(ArrayList shrooms) { // Add all shroomController to list } private void handleSelected() { this.houseSelectedCallback.accept(this); } @FXML public void onClicked() { // here should be some code where you highlight the houseController // handle selected should be called after the highlighting. Otherwise some strange side cases will happen this.handleSelected(); } // I recommend to write some public methods one that, when called, reset the visual selection of the house and // one that sets the visual selection. This makes the manipulation build up in the handleHouseSelect of the // IngameController easier }