Remove duplicate GameObject rotated checks

This commit is contained in:
atomicint
2018-08-28 13:38:11 -04:00
parent 68361110d9
commit 1f539b16ab
4 changed files with 64 additions and 37 deletions
@@ -85,9 +85,10 @@ public final class CollisionManagerTests {
assertUntraversable(collisionManager, back, Direction.SOUTH_EAST);
}
/**
* Tests that a corner wall is untraversable from the sides that it blocks. Corners are much like walls, with
* the only difference being their orientation. Instead of {@link Direction#WNES}, they have diagonal directions.
* Tests that a corner triangular wall is untraversable from the sides that it blocks. Corners are much like walls,
* with the only difference being their orientation. Instead of {@link Direction#WNES}, they have diagonal directions.
* With a corner wall at (0, 1) facing to the north-east we end up with a grid looking like this:
* <p>
* <pre>
@@ -121,6 +122,42 @@ public final class CollisionManagerTests {
assertUntraversable(collisionManager, back, Direction.SOUTH_WEST);
}
/**
* Tests that a corner rectangle wall is untraversable from the sides that it blocks. Corners are much like walls,
* with the only difference being their orientation. Instead of {@link Direction#WNES}, they have diagonal directions.
* With a corner wall at (0, 1) facing to the north-east we end up with a grid looking like this:
* <p>
* <pre>
* (0,2) |---------|---------|
* | | |
* | | |
* | |xxx |
* (0,1) |---------|---------|
* | xxx| |
* | | |
* | | |
* (0,0) |---------|---------|
* (1,0) (2,0) (3,0)
* </pre>
* <p>
* Where you can walk north and east through the tile the corner occupies, as well as south and west through the
* adjacent tile, but not north-east or south-west.
*/
@Test
public void rectangleWall() {
Position front = new Position(0, 1, 0);
Position back = front.step(1, Direction.NORTH_EAST);
CollisionManager collisionManager = createCollisionManager(
createMapObject(WALL, front, ObjectType.RECTANGULAR_CORNER, Direction.NORTH_EAST)
);
assertTraversable(collisionManager, front, Direction.NORTH, Direction.EAST);
assertUntraversable(collisionManager, front, Direction.NORTH_EAST);
assertTraversable(collisionManager, back, Direction.SOUTH, Direction.WEST);
assertUntraversable(collisionManager, back, Direction.SOUTH_WEST);
}
/**
* Tests that the tiles occupied by a 2x2 square object are not traversable. When an interactable object is added
* to a collision update, all tiles spanning its with and length from its origin position will be marked as completely