package de.uniks.pmws1920.controller.ingame.handler; public class MovementHandler { private ; private int amount; private AnchorPane pane; private HouseController sourceHouse; private HouseController targetHouse; private ArrayList shrooms = new ArrayList<>(); private boolean toRemoveAfterFinish = false; private Point sourceCoords; private Point targetCoords; // =================================================================================== // Init // =================================================================================== // this constructor should be used for this homework // this constructor is build to call the constructor below itself. // Is is used to lock the number of shrooms that will be moved by the constant number passed to the constructor below public MovementHandler(HouseController sourceHouse, HouseController targetHouse, AnchorPane pane) { this(sourceHouse, targetHouse, pane, ); } public MovementHandler(HouseController sourceHouse, HouseController targetHouse, AnchorPane pane, int amount) { this.sourceHouse = sourceHouse; this.targetHouse = targetHouse; this.pane = pane; this.amount = amount; this.setup(); } private void setup() { this.placeSelf(); } // =================================================================================== // Init View // =================================================================================== private void placeSelf() { // choose a shape to visualize the set movement // place on pane } // =================================================================================== // Logic // =================================================================================== public void handleMovement() { // extract amount of shroomsController from sourceHouseController // add all shroomsController to targetHouseController // use ModelBuilder to set the new target of the shrooms in the extracted shroomController // When the model is altered after the controllers where shifted, the property change listener constructed in // the last homework will display the arrived shroom correctly. // if this Handler is marked to be removved, call removeYou here } public void markToBeRemoved() { // show visually that this Handler will be removed (in my case, paint the line red) // choose a way to mark this instance to be removed after the next handleMovement() call } public void removeYou() { // look at the fulib generated removeYou()-Methods // this method should cut of all references to other instances // dont forget to remove the used shape from the pane } public boolean canBeRemoved() { // return if marked as to be removed } // =================================================================================== // Helping Methods // =================================================================================== // feel free to write some helping methods }