package objects;
import units.Location;
import javafx.scene.Group;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.transform.Rotate;
public class Cube extends Group {
private Location location;
private ImageView backFace;
private ImageView frontFace;
private ImageView leftFace;
private ImageView rightFace;
private ImageView bottomFace;
private ImageView topFace;
public Cube(double x, double y, double z, double width, double height, double depth){
location = new Location(x, y, z);
location.applyOnNode(this);
backFace = new ImageView();
backFace.setTranslateZ(-depth * 0.5);
frontFace = new ImageView();
frontFace.setTranslateZ(depth * 0.5);
leftFace = new ImageView();
leftFace.setTranslateX(-width * 0.5);
leftFace.setRotationAxis(Rotate.Y_AXIS);
leftFace.setRotate(90);
rightFace = new ImageView();
rightFace.setTranslateX(+width * 0.5);
rightFace.setRotationAxis(Rotate.Y_AXIS);
rightFace.setRotate(90);
bottomFace = new ImageView();
bottomFace.setTranslateY(height * 0.5);
bottomFace.setRotationAxis(Rotate.X_AXIS);
bottomFace.setRotate(90);
topFace = new ImageView();
topFace.setTranslateY(-height * 0.5);
topFace.setRotationAxis(Rotate.X_AXIS);
topFace.setRotate(90);
backFace.setImage(new Image(getClass().getResourceAsStream("/textures/sides.png")));
frontFace.setImage(new Image(getClass().getResourceAsStream("/textures/sides.png")));
leftFace.setImage(new Image(getClass().getResourceAsStream("/textures/sides.png")));
rightFace.setImage(new Image(getClass().getResourceAsStream("/textures/sides.png")));
bottomFace.setImage(new Image(getClass().getResourceAsStream("/textures/bottom.png")));
topFace.setImage(new Image(getClass().getResourceAsStream("/textures/top.png")));
getChildren().addAll(backFace, frontFace, leftFace, rightFace, bottomFace, topFace);
}
public Location getLocation(){
return location;
}
public ImageView getBackFace(){
return backFace;
}
public ImageView getFrontFace(){
return frontFace;
}
public ImageView getLeftFace(){
return leftFace;
}
public ImageView getRightFace(){
return rightFace;
}
public ImageView getBottomFace(){
return bottomFace;
}
public ImageView getTopFace(){
return topFace;
}
}