I have been trying to figure it out but I find problematic switching on Controller.vehicle as it is a floated value. I tried converting it to String but it dosent work and converting it to an integer I am afraid it could loose some precision.
if(Controller.vehicle instanceof Boat) {
file = new File(System.getProperty("user.dir")+"/src/img/boat.png");
}
else if(Controller.vehicle instanceof Ship) {
file = new File(System.getProperty("user.dir")+"/src/img/ship.png");
}
else if(Controller.vehicle instanceof Truck) {
file = new File(System.getProperty("user.dir")+"/src/img/truck.png");
}
else if(Controller.vehicle instanceof Motorcycle) {
file = new File(System.getProperty("user.dir")+"/src/img/motorcycle.png");
}
else if(Controller.vehicle instanceof Bus) {
file = new File(System.getProperty("user.dir")+"/src/img/bus.png");
}
else if(Controller.vehicle instanceof Car) {
file = new File(System.getProperty("user.dir")+"/src/img/car.png");
}
else if(Controller.vehicle instanceof Bicycle) {
file = new File(System.getProperty("user.dir")+"/src/img/bicycle.png");
}
else if(Controller.vehicle instanceof Helicopter) {
file = new File(System.getProperty("user.dir")+"/src/img/helicopter.png");
}
else if(Controller.vehicle instanceof Airplane) {
file = new File(System.getProperty("user.dir")+"/src/img/airplane.png");
}
else if(Controller.vehicle instanceof Tram) {
file = new File(System.getProperty("user.dir")+"/src/img/tram.png");
}
else if(Controller.vehicle instanceof Train) {
file = new File(System.getProperty("user.dir")+"/src/img/train.png");
}