package de.uniks.pmws1920.controller.ingame; public class HouseController { @FXML public ; private ArrayList shroomController = new ArrayList(); private ModelBuilder builder; private AnchorPane pane; private House house; private Player player; private double xPos; private double yPos; private double shapeXOrigin; private double shapeYOrigin; // =================================================================================== // Init // =================================================================================== public void setContent(ModelBuilder builder, AnchorPane pane, House house, double xPos, double yPos) { // save parameter in fields // maybe additional location calculations this.setup(); } private void setup() { this.bindValues(); this.placeSelf(); this.placeShrooms(); } // =================================================================================== // Init View // =================================================================================== // A tip to make the future homework a lot easier. // Follow the instructions about shroom-object and shroom-controller comparison. private void bindValues() { // compare the referenced shrooms of the house with the controllers in the list above // If new shrooms are contained, create a new controller for these // Bind shape the pane // Bind property change listener (aka new shrooms target this house) // -> see if shroom-controller exists // -> manage display of shrooms } // Another tip for clean coding, extract as much reused functionality into their own // methods as you can. This controller creation is just one good example. private void createNewShroomController(Shroom shroom) { // Load View Component // Calc coordinates for the shroom // Get Controller // Set Controller Content } // =================================================================================== // Update View // =================================================================================== public void placeSelf() { // place shape at given (or calculated) position } private void placeShrooms() { // for every shroom-controller // update shroom positions } // =================================================================================== // Logic // =================================================================================== @FXML public void onClicked() { // change appearance of the house on click } // =================================================================================== // Helping Methods // =================================================================================== // feel free to add setter/getter or other kinds of self written methods }