/** * Calculates whether certain Location is suitable for spawning a new Building (out of bounds, * overlapping) * * @param loc Location that should be checked * @return Boolean indicating elgibility to spawn new Building * @see Building */ public Boolean checkPositionElgibility(Location loc) { for (Building b : WorldManager.getInstance().getBuildings()) { if (loc.X() >= b.getPosition().X() - SimulationConfig.getBuildingSpriteWidth() && loc.X() <= b.getPosition().X() + SimulationConfig.getBuildingSpriteWidth() && loc.Y() >= b.getPosition().Y() - SimulationConfig.getBuildingSpriteHeight() && loc.Y() <= b.getPosition().Y() + SimulationConfig.getBuildingSpriteHeight()) return false; } return true; }
/** * Calculates diagonal of whole universe and basing on that returns needed fuel max capacity * * @return minimum fuel needed to travel whole map */ public double getMinFuel() { return Math.sqrt( Math.pow(SimulationConfig.getWindowWidth(), 2) + Math.pow(SimulationConfig.getWindowHeight(), 2)); }