Documentatie
This commit is contained in:
@@ -3,10 +3,20 @@ package worms.model;
|
||||
import worms.util.Coordinate;
|
||||
|
||||
public class Food extends GameObject {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param world
|
||||
* @param location
|
||||
*
|
||||
* @post ...
|
||||
* |setWorld(world)
|
||||
* @post ...
|
||||
* |setLocation(location)
|
||||
* @post ...
|
||||
* |setOrientation(0.2)
|
||||
* @post ...
|
||||
* |setMass(getRadius(), 150)
|
||||
*/
|
||||
public Food(World world, double[] location) {
|
||||
super(world, location, 0.2);
|
||||
|
@@ -9,6 +9,21 @@ import static java.lang.Math.round;
|
||||
|
||||
public abstract class GameObject {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param world
|
||||
* @param location
|
||||
* @param radius
|
||||
*
|
||||
* @post ...
|
||||
* |setWorld(world)
|
||||
* @post ...
|
||||
* |world.add(this)
|
||||
* @post ...
|
||||
* |setLocation(location)
|
||||
* @post ...
|
||||
* |setRadius(radius)
|
||||
*/
|
||||
GameObject(World world, double[] location, double radius) {
|
||||
setWorld(world);
|
||||
world.add(this);
|
||||
@@ -18,19 +33,33 @@ public abstract class GameObject {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param world ...
|
||||
* @param world
|
||||
*
|
||||
* @return ...
|
||||
* |result == !world.hasActiveGame() && !world.isTerminated()
|
||||
*/
|
||||
public static boolean isValidWorld(World world) {
|
||||
return !world.hasActiveGame() && !world.isTerminated();
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return World
|
||||
* @return ...
|
||||
* |result == this.world
|
||||
*/
|
||||
public World getWorld() {
|
||||
return this.world;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param world
|
||||
*
|
||||
* @post ...
|
||||
* |if world == null
|
||||
* | this.world = null
|
||||
* |else:
|
||||
* | this.world = world
|
||||
*/
|
||||
public void setWorld(World world) {
|
||||
if (world == null) {
|
||||
this.world = null;
|
||||
@@ -40,23 +69,33 @@ public abstract class GameObject {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private World world;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |result == this.terminated
|
||||
*/
|
||||
public boolean isTerminated() {
|
||||
return this.terminated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Terminate the object
|
||||
* @post ...
|
||||
* |this.terminated = true
|
||||
* |getWorld().remove(this)
|
||||
*/
|
||||
public void terminate() {
|
||||
this.terminated = true;
|
||||
getWorld().remove(this);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private boolean terminated = false;
|
||||
|
||||
|
||||
@@ -74,6 +113,12 @@ public abstract class GameObject {
|
||||
Coordinate getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |result == this.location.toArray()
|
||||
*/
|
||||
public double[] getLocationArray() {
|
||||
return this.location.toArray();
|
||||
}
|
||||
@@ -97,6 +142,17 @@ public abstract class GameObject {
|
||||
this.location = locationCoordinate;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param location
|
||||
*
|
||||
* @post ...
|
||||
* this.location = location
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* ...
|
||||
* |!isValidLocation(location)
|
||||
*/
|
||||
void setLocation(Coordinate location) throws IllegalArgumentException {
|
||||
|
||||
if (!isValidLocation(location)) throw new IllegalArgumentException();
|
||||
@@ -117,6 +173,14 @@ public abstract class GameObject {
|
||||
public double getRadius(){
|
||||
return this.radius;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param radius
|
||||
*
|
||||
* @post ...
|
||||
* |this.radius = radius
|
||||
*/
|
||||
void setRadius(double radius) {
|
||||
if (!canHaveAsRadius(radius)) throw new IllegalArgumentException();
|
||||
this.radius = radius;
|
||||
@@ -136,6 +200,21 @@ public abstract class GameObject {
|
||||
return !Double.isNaN(radius) && radius > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param location
|
||||
*
|
||||
* @return ...
|
||||
* |if (world == null)
|
||||
* | result == !Double.isNaN(location.getX()) && !Double.isNaN(location.getY())
|
||||
* |result == !Double.isNaN(location.getX()) &&
|
||||
* | !Double.isNaN(location.getY()) &&
|
||||
* | !(location.getX() - radius < 0) &&
|
||||
* | !(location.getX() + radius > getWorld().getWidth()) &&
|
||||
* | !(location.getY() + radius > getWorld().getHeight()) &&
|
||||
* | !(location.getY() - radius < 0 &&
|
||||
* | !getWorld().isPassable(location))
|
||||
*/
|
||||
boolean isValidLocation(Coordinate location) {
|
||||
double radius = getRadius();
|
||||
|
||||
@@ -153,7 +232,16 @@ public abstract class GameObject {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
double mass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |result == this.mass
|
||||
*/
|
||||
public double getMass() {
|
||||
return this.mass;
|
||||
}
|
||||
|
@@ -9,6 +9,15 @@ public class Team {
|
||||
// region constructor
|
||||
//===================================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
*
|
||||
* @post ...
|
||||
* |setName(name)
|
||||
* @post ...
|
||||
* |wormCollection = new Treeset<>(new TeamComparator())
|
||||
*/
|
||||
public Team (String name) {
|
||||
setName(name);
|
||||
this.wormCollection = new TreeSet<>(new TeamComparator());
|
||||
@@ -24,9 +33,11 @@ public class Team {
|
||||
* @param worm
|
||||
*
|
||||
* @post ...
|
||||
* |new.team = old.team + Worm... worm
|
||||
* |new.team = old.team + worm
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* ...
|
||||
* |worm == null || ! canHaveAsWorm(worm)
|
||||
*/
|
||||
public void addWorm(Worm... worm) throws IllegalArgumentException {
|
||||
if (worm == null) throw new IllegalArgumentException();
|
||||
@@ -42,12 +53,17 @@ public class Team {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param worm ..
|
||||
*
|
||||
* @return
|
||||
* |for each i in [0,team.size()[
|
||||
* | result == (worm.getMass() > getMinMassTeam()/2 && worm.getMass() < 2 * getMaxMassTeam()
|
||||
* | && worm.isAlive() && (team.get(i)).getName() != worm.getName())
|
||||
* @param worm
|
||||
*
|
||||
* @return ...
|
||||
* |if (worm.getMass() >= getMinMassTeam() / 2 && worm.getMass() <= 2 * getMinMassTeam() && !worm.isTerminated())
|
||||
* | for (Worm elWorm : worms)
|
||||
* | if (! elWorm.getName().equals(worm.getName()))
|
||||
* | result == true
|
||||
* @throws IllegalArgumentException
|
||||
* ...
|
||||
* |worm == null
|
||||
*/
|
||||
private boolean canHaveAsWorm(Worm worm) throws IllegalArgumentException {
|
||||
|
||||
@@ -67,10 +83,17 @@ public class Team {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param worm
|
||||
*
|
||||
* @post ...
|
||||
* |(new.team).contains(Worm... worm) == false
|
||||
* |getAllwormsOfTeam().remove(worm)
|
||||
* @post ...
|
||||
* |worm.setTeam(null)
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* ...
|
||||
* |worm == null
|
||||
*/
|
||||
public void removeWormsFromTeam(Worm... worm) throws IllegalArgumentException {
|
||||
|
||||
@@ -83,32 +106,50 @@ public class Team {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param worm ...
|
||||
*
|
||||
* @param worm
|
||||
*
|
||||
* @return ...
|
||||
* |result == team.contains(worm)
|
||||
* |result == getAllWormsOfTeam().contains(worm)
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* ...
|
||||
* |worm == null
|
||||
*/
|
||||
public boolean containsWorm(Worm worm) throws IllegalArgumentException {
|
||||
if (worm == null) throw new IllegalArgumentException();
|
||||
return getAllWormsOfTeam().contains(worm);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |wormCollection
|
||||
*/
|
||||
public Collection<Worm> getAllWormsOfTeam() {
|
||||
return wormCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |getAllWormsOfTeam().size()
|
||||
*/
|
||||
public int getNbWorms() {
|
||||
return getAllWormsOfTeam().size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param receivingTeam ...
|
||||
* @param supplyingTeam ...
|
||||
*
|
||||
* @post ... (NOG NIET ZEKER VAN)
|
||||
* |recevingTeam == receivingTeam + supplyingTeam
|
||||
* @param receivingTeam
|
||||
* @param supplyingTeam
|
||||
*
|
||||
* @post ...
|
||||
* |supplyingTeam.isTerminated() == true
|
||||
* |receivingTeam.addWorm(supplyingTeam)
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* ...
|
||||
* |receivingTeam == null || supplyingTeam == null || receivingTeam.equals(supplyingTeam)
|
||||
*/
|
||||
public static void mergeTeams(Team receivingTeam, Team supplyingTeam) throws IllegalArgumentException {
|
||||
|
||||
@@ -121,6 +162,9 @@ public class Team {
|
||||
supplyingTeam.removeWormsFromTeam(supWorms);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Collection<Worm> wormCollection;
|
||||
|
||||
//===================================================================================
|
||||
@@ -130,7 +174,13 @@ public class Team {
|
||||
//===================================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |(getAllWormsOfTeam().stream().min(Comparator.comparingDouble(Worm::getMass)).orElse(null)).getMass()
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
* ...
|
||||
* |minMass == null
|
||||
*/
|
||||
private double getMinMassTeam() throws IllegalStateException {
|
||||
Worm minMass = getAllWormsOfTeam().stream().min(Comparator.comparingDouble(Worm::getMass)).orElse(null);
|
||||
@@ -147,6 +197,7 @@ public class Team {
|
||||
//===================================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |result == this.name
|
||||
*/
|
||||
@@ -154,14 +205,16 @@ public class Team {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param name ...
|
||||
*
|
||||
* @post |new.getName() == name
|
||||
* @param name
|
||||
*
|
||||
* @post ...
|
||||
* |new.getName() == name
|
||||
*
|
||||
* @throws IllegalNameException
|
||||
* |! isValidName(name)
|
||||
* ...
|
||||
* |Worm.isValidName(name) != -1
|
||||
*/
|
||||
public void setName(String name) throws IllegalNameException {
|
||||
|
||||
@@ -172,6 +225,9 @@ public class Team {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String name;
|
||||
|
||||
//===================================================================================
|
||||
@@ -181,9 +237,8 @@ public class Team {
|
||||
//===================================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @post
|
||||
* |new.terminate == true
|
||||
* @post ...
|
||||
* |new.terminatd = true
|
||||
*/
|
||||
public void terminate() {
|
||||
this.terminated = true;
|
||||
@@ -192,15 +247,15 @@ public class Team {
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |if terminate == true
|
||||
* | result == true
|
||||
* |else
|
||||
* | result == false
|
||||
* |result == this.terminated
|
||||
*/
|
||||
public boolean isTerminated() {
|
||||
return this.terminated;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private boolean terminated = false;
|
||||
|
||||
//===================================================================================
|
||||
|
@@ -6,6 +6,27 @@ import java.util.*;
|
||||
|
||||
public class World {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param width
|
||||
* @param height
|
||||
* @param map
|
||||
*
|
||||
* @post ...
|
||||
* new.width = width
|
||||
* @post ...
|
||||
* new.height = height
|
||||
* @post ...
|
||||
* new.map = map
|
||||
* @post ...
|
||||
* new.legthX = width / map[0].length
|
||||
* @post ...
|
||||
* new.lengthY = height / map.length
|
||||
* @post ...
|
||||
* new.game = false
|
||||
* @post ...
|
||||
* new.gameObjets = new HashSet<>()
|
||||
*/
|
||||
public World(double width, double height, boolean[][] map) {
|
||||
|
||||
if (!isValidDimension(width) || !isValidDimension(height)) throw new IllegalArgumentException();
|
||||
@@ -84,17 +105,43 @@ public class World {
|
||||
// region Dimensions
|
||||
//===================================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dimension
|
||||
*
|
||||
* @return ...
|
||||
* |result == dimension >= 0.0 && dimension <= Double.MAX_VALUE
|
||||
*/
|
||||
public static boolean isValidDimension(double dimension) {
|
||||
return dimension >= 0.0 && dimension <= Double.MAX_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |result == width
|
||||
*/
|
||||
public double getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |result == height
|
||||
*/
|
||||
public double getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final double width;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final double height;
|
||||
|
||||
// ===================================================================================
|
||||
@@ -104,20 +151,41 @@ public class World {
|
||||
|
||||
// region map
|
||||
//===================================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |result == map
|
||||
*/
|
||||
public boolean[][] getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* result = this.terminated
|
||||
*/
|
||||
public boolean isTerminated() {
|
||||
return this.terminated;
|
||||
}
|
||||
|
||||
/**
|
||||
* @post ...
|
||||
* |this.terminated = true
|
||||
*/
|
||||
public void terminate() {
|
||||
this.terminated = true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final boolean[][] map;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private boolean terminated = false;
|
||||
|
||||
// ===================================================================================
|
||||
@@ -128,8 +196,14 @@ public class World {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param location ...
|
||||
* @param location
|
||||
*
|
||||
* @return ...
|
||||
* |false if:
|
||||
* | Math.floor(location[0] / lengthX) >= getMap()[0].length ||
|
||||
* | location[0] < 0.0 || location[1] / lengthY >= getMap().length || location[1] < 0.0
|
||||
* |various:
|
||||
* | result == this.map[(int) Math.floor(location[1] / lengthY)][(int) Math.floor(location[0] / lengthX)]
|
||||
*/
|
||||
public boolean isPassable(double[] location) {
|
||||
|
||||
@@ -140,14 +214,44 @@ public class World {
|
||||
return this.map[(int) Math.floor(location[1] / lengthY)][(int) Math.floor(location[0] / lengthX)];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param location
|
||||
*
|
||||
* @return ...
|
||||
* |result == this.isPassable(location.toArray())
|
||||
*/
|
||||
public boolean isPassable(Coordinate location) {
|
||||
return this.isPassable(location.toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param location
|
||||
* @param radius
|
||||
*
|
||||
* @return ...
|
||||
* |result == this.isPassable(location.toArray(), radius)
|
||||
*/
|
||||
public boolean isPassable(Coordinate location, double radius) {
|
||||
return this.isPassable(location.toArray(), radius);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param center
|
||||
* @param radius
|
||||
*
|
||||
* @return ...
|
||||
* |for (double i = 0; i < 2 * Math.PI; i += Math.PI / 180)
|
||||
* | double lenX = center[0] + radius * Math.cos(i)
|
||||
* | double lenY = center[1] + radius * Math.sin(i)
|
||||
* | if (i < 1.58 && i > 1.57)
|
||||
* | lenY -= 0.0000000001
|
||||
* | else if (i < 0.79 && i > 0.78 )
|
||||
* | lenX -= 0.0000000001
|
||||
* |result == isPassable(lenX, lenY)
|
||||
*/
|
||||
public boolean isPassable(double[] center, double radius) {
|
||||
|
||||
for (double i = 0; i < 2 * Math.PI; i += Math.PI / 180) {
|
||||
@@ -171,6 +275,7 @@ public class World {
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |result == isAdjacent(Coordinate.create(center), radius)
|
||||
*/
|
||||
public boolean isAdjacent(double[] center, double radius) {
|
||||
return isAdjacent(Coordinate.create(center), radius);
|
||||
@@ -180,7 +285,9 @@ public class World {
|
||||
*
|
||||
* @param center ...
|
||||
* @param radius ...
|
||||
*
|
||||
* @return ...
|
||||
* |result == isPassable(center, radius) && !isPassable(center, radius + maxDistance + 0.00001)
|
||||
*/
|
||||
public boolean isAdjacent(Coordinate center, double radius) {
|
||||
|
||||
@@ -191,20 +298,47 @@ public class World {
|
||||
return isPassable(center, radius) && !isPassable(center, radius + maxDistance + 0.00001);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |result == this.lengtX
|
||||
*/
|
||||
public double getLengthX() {
|
||||
return this.lengthX;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |result == this.lengthY
|
||||
*/
|
||||
public double getLengthY() {
|
||||
return this.lengthY;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final double lengthX;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final double lengthY;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param x ...
|
||||
* @param y ...
|
||||
* @param x
|
||||
* @param y
|
||||
*
|
||||
* @return ...
|
||||
* |xCoord = Math.floor(x / lengthX);
|
||||
* |yCoord = map.length - 1 - Math.floor(y / lengthY);
|
||||
* |if (yCoord < 0 || yCoord >= map.length)
|
||||
* | return true
|
||||
* |if (xCoord < 0 || xCoord >= map[0].length)
|
||||
* | return true
|
||||
* |return getMap()[yCoord][xCoord]
|
||||
*/
|
||||
private boolean isPassable(double x, double y) {
|
||||
|
||||
@@ -230,11 +364,21 @@ public class World {
|
||||
// region objects
|
||||
//===================================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |result == new ArrayList<>(getGameObjects())
|
||||
*/
|
||||
public Collection<Object> getAllItems() {
|
||||
|
||||
return new ArrayList<>(getGameObjects());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |result == teams
|
||||
*/
|
||||
public Set<Team> getAllTeams() {
|
||||
|
||||
Set<Team> teams = new HashSet<Team>();
|
||||
@@ -244,24 +388,66 @@ public class World {
|
||||
return teams;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |result == this.gameObjects
|
||||
*/
|
||||
public Set<GameObject> getGameObjects() {
|
||||
return this.gameObjects;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param obj
|
||||
*
|
||||
* @post obj.setWorld(this)
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
* ...
|
||||
* |hasActiveGame()
|
||||
* @throws IllegalArgumentException
|
||||
* ...
|
||||
* |!getGameObjects().add(obj)
|
||||
*/
|
||||
public void add(GameObject obj) throws NullPointerException {
|
||||
if (hasActiveGame()) throw new IllegalStateException();
|
||||
if (!getGameObjects().add(obj)) throw new IllegalArgumentException();
|
||||
obj.setWorld(this);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param obj
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* ...
|
||||
* |!getGameObjects().remove(obj)
|
||||
*/
|
||||
public void remove(GameObject obj) throws IllegalArgumentException {
|
||||
|
||||
if (!getGameObjects().remove(obj)) throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param obj
|
||||
*
|
||||
* @return ...
|
||||
* |getGameObjects().contains(obj)
|
||||
*
|
||||
* @throws NullPointerException
|
||||
*/
|
||||
public boolean hasAsGameObject(GameObject obj) throws NullPointerException {
|
||||
return getGameObjects().contains(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |lis.add(worm) for each worm
|
||||
* |result == list (ArrayList<>())
|
||||
*/
|
||||
public List<Worm> getWormList() {
|
||||
|
||||
List<Worm> list = new ArrayList<>();
|
||||
@@ -273,6 +459,12 @@ public class World {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ...
|
||||
* |list.add(food) for each food
|
||||
* |result == list (ArrayList<>())
|
||||
*/
|
||||
public List<Food> getFoodList() {
|
||||
List<Food> list = new ArrayList<>();
|
||||
for (GameObject x : getGameObjects()) {
|
||||
@@ -283,6 +475,14 @@ public class World {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cl
|
||||
*
|
||||
* @return ...
|
||||
* |list.add(gameObject) for each gameObject
|
||||
* |result == list (ArrayList<>())
|
||||
*/
|
||||
public List<GameObject> getGameObjectList(Class cl) {
|
||||
List<GameObject> list = new ArrayList<>();
|
||||
for (GameObject x : getGameObjects()) {
|
||||
@@ -293,6 +493,9 @@ public class World {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Set<GameObject> gameObjects;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user