Commit d2a63cef authored by Lukas Marik's avatar Lukas Marik

#940 set middle texture

parent e20256eb
......@@ -57,6 +57,7 @@ public class GameObject extends ObjectModel {
private static final Interpolation CARD_INTERPOLATION = Interpolation.swingOut;
private static final Interpolation BIGGER_INTERPOLATION = Interpolation.linear;
private static final String MIDDLE_PREFIX = "_m";
private static final float MOVE_DURATION = 0.3f;
private static final float SMALL_DURATION = 0.235f;
private static final float BIGGER_DURATION = 0.08f;
......@@ -101,6 +102,7 @@ public class GameObject extends ObjectModel {
private boolean fixed;
private boolean scaling;
private boolean rotate;
private boolean middle;
public GameObject(GameObjectType type, ProtocolGame protocolGame, String cardText, boolean inPicture) {
this.type = type;
......@@ -112,6 +114,7 @@ public class GameObject extends ObjectModel {
selected = false;
fixed = false;
rotate = false;
middle = false;
cardDrawable = protocolGame.getScreenTextureRegion(type.getCardTexturePath());
objectDrawable = protocolGame.getScreenTextureRegion(type.getObjectTexturePath());
......@@ -269,6 +272,19 @@ public class GameObject extends ObjectModel {
objectDrawable.flip(rotateX, false);
}
public void middleTexture(boolean useMiddleTexture){
if(middle == useMiddleTexture)
return;
objectDrawable = protocolGame.getScreenTextureRegion(type.getObjectTexturePath() + (useMiddleTexture ? MIDDLE_PREFIX : ""));
objectImage.setDrawable(new TextureRegionDrawable(objectDrawable));
changeSize();
this.middle = useMiddleTexture;
if(useMiddleTexture)
rotate = false;
}
//////////////////////////// SCALE ACTIONS
......
......@@ -125,6 +125,7 @@ public class RoomGroup extends Group {
WallObjectDescriptor descriptor = WallObjectDescriptor.getDescriptorByType(gameObject.getType());
WallType objectOrientation = descriptor.getWallOrientation();
gameObject.middleTexture(wallType == WallType.MIDDLE_WALL);
gameObject.rotateObject(objectOrientation != wallType && wallType != WallType.MIDDLE_WALL);
//TODO zkontrolovat precuhovani
......@@ -157,6 +158,7 @@ public class RoomGroup extends Group {
gameObject.setFurniture(null);
gameObject.setRoomPosition(null);
gameObject.setWallPositionType(null);
gameObject.middleTexture(false);
gameObject.rotateObject(gameObject.isRotate());
}
......@@ -264,13 +266,8 @@ public class RoomGroup extends Group {
if((position == RoomPosition.WALL || previousPosition == RoomPosition.WALL) && wallType != changedObject.getWallPositionType()) {
WallObjectDescriptor descriptor = WallObjectDescriptor.getDescriptorByType(changedObject.getType());
boolean isRotate = changedObject.isRotate();
if(position != RoomPosition.WALL){
changedObject.rotateObject(isRotate);
}else {
boolean needRotate = descriptor.getWallOrientation() != wallType && wallType != WallType.MIDDLE_WALL;
changedObject.rotateObject(isRotate ^ needRotate);
}
changedObject.middleTexture(wallType == WallType.MIDDLE_WALL);
changedObject.rotateObject(position != RoomPosition.WALL ? isRotate : isRotate ^ (descriptor.getWallOrientation() != wallType && wallType != WallType.MIDDLE_WALL));
}
if(position == RoomPosition.WALL)
......@@ -305,10 +302,15 @@ public class RoomGroup extends Group {
"RB ON WALL: " + checkRBPoints + "\n" +
"RT ON WALL: " + checkRTPoints);
if(checkLBPoints && checkLTPoints && checkRBPoints && checkRTPoints)
Log.info("WALL_CHECK", "object is on wall");
else
Log.info("WALL_CHECK", "only part of object is on wall");
if(!(checkLBPoints && checkLTPoints && checkRBPoints && checkRTPoints)){
//kontrola kam posunout
int pointsCNT =(checkLBPoints ? 0 : 1) + (checkLTPoints ? 0 : 1) + (checkRBPoints ? 0 : 1) + (checkRTPoints ? 0 : 1);
Log.info("WALL_CHECK", "POINTS CNT: " + pointsCNT);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment