feat: properly expose EntityManager
This commit is contained in:
parent
bd442bedfc
commit
7bac3bd46a
@ -22,7 +22,7 @@ public class EntityManager {
|
||||
* Takes over all the entities from a different {@link EntityManager}.
|
||||
* @param other The entity list to take the data from
|
||||
*/
|
||||
public void cloneFrom(EntityManager other) {
|
||||
void cloneFrom(EntityManager other) {
|
||||
entities.clear();
|
||||
for(Entity entity: other.entities) {
|
||||
entities.add(entity.clone());
|
||||
@ -36,7 +36,7 @@ public class EntityManager {
|
||||
* Finds an unused {@link Rock} entity id
|
||||
* @return The first free id
|
||||
*/
|
||||
public int findFreeRockSlot() {
|
||||
int findFreeRockSlot() {
|
||||
int i = 0;
|
||||
while(usedRockSlots.contains(i)) {
|
||||
i++;
|
||||
@ -47,7 +47,7 @@ public class EntityManager {
|
||||
/**
|
||||
* Clears the list of entities.
|
||||
*/
|
||||
public void clear() {
|
||||
void clear() {
|
||||
entities.clear();
|
||||
usedRockSlots.clear();
|
||||
}
|
||||
@ -56,7 +56,7 @@ public class EntityManager {
|
||||
* Adds an entity to the list.
|
||||
* @param entity The {@link Entity} to add
|
||||
*/
|
||||
public void addEntity(Entity entity) {
|
||||
void addEntity(Entity entity) {
|
||||
if(entity.id.isSameType(EntityType.Rocks)) {
|
||||
usedRockSlots.add(entity.id.id);
|
||||
}
|
||||
@ -67,7 +67,7 @@ public class EntityManager {
|
||||
* Adds multiple entities to the list.
|
||||
* @param entities The entities to add
|
||||
*/
|
||||
public void addEntities(Entity... entities) {
|
||||
void addEntities(Entity... entities) {
|
||||
for(Entity e: entities) {
|
||||
this.addEntity(e);
|
||||
}
|
||||
@ -77,7 +77,7 @@ public class EntityManager {
|
||||
* Removes an entity from the list.
|
||||
* @param entity The {@link Entity} to remove
|
||||
*/
|
||||
public boolean removeEntity(Entity entity) {
|
||||
boolean removeEntity(Entity entity) {
|
||||
if(entity.id.isSameType(EntityType.Rocks)) {
|
||||
usedRockSlots.remove(entity.id.id);
|
||||
}
|
||||
@ -88,7 +88,7 @@ public class EntityManager {
|
||||
* Removes an entity from the list.
|
||||
* @param entityid The {@link EntityID} of the {@link Entity} to remove
|
||||
*/
|
||||
public boolean removeEntity(EntityID entityid) {
|
||||
boolean removeEntity(EntityID entityid) {
|
||||
Entity entity = findEntity(entityid);
|
||||
if(entity != null) {
|
||||
return entities.remove(entity);
|
||||
@ -166,7 +166,7 @@ public class EntityManager {
|
||||
* Exports all entities as an array.
|
||||
* @return An array containing every {@link Entity}
|
||||
*/
|
||||
public Entity[] export() {
|
||||
Entity[] export() {
|
||||
return (Entity[])entities.toArray();
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ public class GameStateView {
|
||||
return state.mapSize;
|
||||
}
|
||||
|
||||
public Iterator<Entity> getEntities() {
|
||||
return state.entities.getEntities();
|
||||
public EntityManager getEntities() {
|
||||
return state.entities;
|
||||
}
|
||||
|
||||
public int getRoundNumber() {
|
||||
|
Loading…
Reference in New Issue
Block a user