mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Flytter ting til korrekte pakker og forbedrer Tile og Wall
Fikser kommentarer, mellomrom og variabelnavn i Tile og Wall Flytter IGrid, Robot og Wall til objects Flytter tester til korresponderende pakker
This commit is contained in:
parent
2eac95fef9
commit
a6a0045786
@ -1,39 +0,0 @@
|
||||
package inf112.fiasko.roborally.element_properties;
|
||||
|
||||
public class Wall {
|
||||
/**
|
||||
* This class is a representation of a wall
|
||||
*/
|
||||
private WallType wall;
|
||||
private Direction direction;
|
||||
|
||||
/**
|
||||
* Initializes the wall
|
||||
* @param wall gives the type of wall eks. wall normal or wall corner
|
||||
* @param direction gives the direction the wall is facing.
|
||||
*/
|
||||
public Wall (WallType wall,Direction direction){
|
||||
this.wall = wall;
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of the wall
|
||||
* @return the wall type
|
||||
*/
|
||||
public WallType getWallType() {
|
||||
return wall;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the direction of the wall
|
||||
* @return the direction of the wall
|
||||
*/
|
||||
public Direction getDirection(){
|
||||
return direction;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package inf112.fiasko.roborally.element_properties;
|
||||
package inf112.fiasko.roborally.objects;
|
||||
|
||||
/**
|
||||
* This Interface describes a grid
|
@ -1,7 +1,9 @@
|
||||
package inf112.fiasko.roborally.element_properties;
|
||||
package inf112.fiasko.roborally.objects;
|
||||
|
||||
import inf112.fiasko.roborally.element_properties.Position;
|
||||
|
||||
/**
|
||||
* this class represtents a robot
|
||||
* this class represents a robot
|
||||
*/
|
||||
public class Robot {
|
||||
private int robotDamageTaken = 0;
|
@ -3,38 +3,38 @@ package inf112.fiasko.roborally.objects;
|
||||
import inf112.fiasko.roborally.element_properties.Direction;
|
||||
import inf112.fiasko.roborally.element_properties.TileType;
|
||||
|
||||
/**
|
||||
* This class represents a simple tile
|
||||
*/
|
||||
public class Tile {
|
||||
|
||||
/**
|
||||
* tileType stores the type of the specific tile.
|
||||
*/
|
||||
private TileType tileType;
|
||||
/**
|
||||
* direction stores the direction of the specific tile.
|
||||
*/
|
||||
private Direction direction;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tileType sets the type of the tile.
|
||||
* @param direction sets the direction the tile is facing.
|
||||
* Instantiates a new tile
|
||||
* @param tileType The type of the tile
|
||||
* @param direction The direction of the tile
|
||||
*/
|
||||
public Tile(TileType tileType, Direction direction) {
|
||||
if (direction.getDirectionID() % 2 == 0) {
|
||||
throw new IllegalArgumentException("Invalid direction for tile submitted");
|
||||
}
|
||||
this.tileType = tileType;
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the type of the specific tile.
|
||||
* Gets the tile type of the tile
|
||||
* @return The tile's tile type
|
||||
*/
|
||||
public TileType getTileType() {
|
||||
return tileType;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the direction of the specific tile.
|
||||
* Gets the direction of the tile
|
||||
* @return The tile's direction
|
||||
*/
|
||||
public Direction getDirection() {
|
||||
return direction;
|
||||
|
39
src/main/java/inf112/fiasko/roborally/objects/Wall.java
Normal file
39
src/main/java/inf112/fiasko/roborally/objects/Wall.java
Normal file
@ -0,0 +1,39 @@
|
||||
package inf112.fiasko.roborally.objects;
|
||||
|
||||
import inf112.fiasko.roborally.element_properties.Direction;
|
||||
import inf112.fiasko.roborally.element_properties.WallType;
|
||||
|
||||
/**
|
||||
* This class represents a wall
|
||||
*/
|
||||
public class Wall {
|
||||
|
||||
private WallType wallType;
|
||||
private Direction direction;
|
||||
|
||||
/**
|
||||
* Initializes a wall
|
||||
* @param wallType The type of the wall
|
||||
* @param direction The direction of the wall
|
||||
*/
|
||||
public Wall (WallType wallType, Direction direction) {
|
||||
this.wallType = wallType;
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of the wall
|
||||
* @return The wall type
|
||||
*/
|
||||
public WallType getWallType() {
|
||||
return wallType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the direction of the wall
|
||||
* @return The direction of the wall
|
||||
*/
|
||||
public Direction getDirection(){
|
||||
return direction;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package inf112.fiasko.roborally;
|
||||
package inf112.fiasko.roborally.element_properties;
|
||||
|
||||
import inf112.fiasko.roborally.element_properties.Direction;
|
||||
import org.junit.Test;
|
@ -1,4 +1,4 @@
|
||||
package inf112.fiasko.roborally;
|
||||
package inf112.fiasko.roborally.element_properties;
|
||||
|
||||
import inf112.fiasko.roborally.element_properties.Position;
|
||||
import org.junit.Before;
|
@ -1,4 +1,4 @@
|
||||
package inf112.fiasko.roborally;
|
||||
package inf112.fiasko.roborally.element_properties;
|
||||
|
||||
import inf112.fiasko.roborally.element_properties.TileType;
|
||||
import org.junit.Test;
|
@ -1,4 +1,4 @@
|
||||
package inf112.fiasko.roborally;
|
||||
package inf112.fiasko.roborally.element_properties;
|
||||
|
||||
import inf112.fiasko.roborally.element_properties.TileType;
|
||||
import inf112.fiasko.roborally.element_properties.WallType;
|
@ -1,4 +1,4 @@
|
||||
package inf112.fiasko.roborally;
|
||||
package inf112.fiasko.roborally.game;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
@ -1,4 +1,4 @@
|
||||
package inf112.fiasko.roborally;
|
||||
package inf112.fiasko.roborally.objects;
|
||||
|
||||
import inf112.fiasko.roborally.objects.DrawableObject;
|
||||
import inf112.fiasko.roborally.element_properties.GameTexture;
|
@ -1,7 +1,7 @@
|
||||
package inf112.fiasko.roborally;
|
||||
package inf112.fiasko.roborally.objects;
|
||||
|
||||
import inf112.fiasko.roborally.element_properties.Position;
|
||||
import inf112.fiasko.roborally.element_properties.Robot;
|
||||
import inf112.fiasko.roborally.objects.Robot;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Test;
|
||||
|
@ -1,8 +1,7 @@
|
||||
package inf112.fiasko.roborally;
|
||||
package inf112.fiasko.roborally.objects;
|
||||
|
||||
import inf112.fiasko.roborally.element_properties.Direction;
|
||||
import inf112.fiasko.roborally.element_properties.TileType;
|
||||
import inf112.fiasko.roborally.objects.Tile;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -38,4 +37,9 @@ public class TileTest {
|
||||
public void getDirectionFromTile2() {
|
||||
assertEquals(Direction.SOUTH, tile2.getDirection());
|
||||
}
|
||||
|
||||
@Test (expected = IllegalArgumentException.class)
|
||||
public void invalidTileThrowsException() {
|
||||
new Tile(TileType.TRANSPORT_BAND_FAST, Direction.NORTH_EAST);
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package inf112.fiasko.roborally;
|
||||
package inf112.fiasko.roborally.objects;
|
||||
|
||||
import inf112.fiasko.roborally.element_properties.Direction;
|
||||
import inf112.fiasko.roborally.element_properties.Wall;
|
||||
import inf112.fiasko.roborally.objects.Wall;
|
||||
import inf112.fiasko.roborally.element_properties.WallType;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Test;
|
Loading…
x
Reference in New Issue
Block a user