Skip to content

Commit

Permalink
even more issues fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
rofidakhaled committed Jan 11, 2025
1 parent cada3be commit f92c2a4
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 33 deletions.
19 changes: 0 additions & 19 deletions entity-component-system/src/main/java/com/iluwatar/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class Entity {
private boolean isEnabled;
private TransformComponent transform;
private Entity parent;
private GameSystem gameSystem;
private List<Component> components;
private List<Entity> children;

Expand Down Expand Up @@ -262,24 +261,6 @@ public void setIsEnabled(boolean isEnabled) {
}
}

/**
* Gets the game system this entity belongs to.
*
* @return the game system the entity is part of
*/
public GameSystem getGameSystem() {
return gameSystem;
}

/**
* Sets the game system this entity belongs to.
*
* @param gameSystem the game system to set
*/
public void setGameSystem(GameSystem gameSystem) {
this.gameSystem = gameSystem;
}

/**
* Gets the parent entity of this entity.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ public GameSystem() {
public void addEntity(Entity entity) {
if (entity != null) {
entities.add(entity);
entity.setGameSystem(this);

// Recursively add children entities
for (Entity child : entity.getChildren()) {
addEntity(child);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ void testFinalEntityStateAfterSimulation() {
GameSystem gameSystem = new GameSystem();
gameSystem.addEntity(entity1);
gameSystem.addEntity(entity2);
TransformComponent TestTransform = new TransformComponent(new float[]{5.0f, 0.0f, 0.0f},
TransformComponent testTransform = new TransformComponent(new float[]{5.0f, 0.0f, 0.0f},
new float[]{0.0f, 45.0f, 0.0f}, new float[]{1.0f, 1.0f, 1.0f});
entity1.setTransformComponent(TestTransform);
entity1.setTransformComponent(testTransform);

for (int i = 0; i < 10; i++) {
gameSystem.update(1.0f / 60.0f);
Expand Down
10 changes: 0 additions & 10 deletions entity-component-system/src/test/java/com/iluwatar/EntityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,6 @@ void testSetIsEnabled() {
assertTrue(entityChild.isEnabled(), "The entity child should be enabled after calling setIsEnabled(true).");
}

@Test
void testGetAndSetGameSystem() {

GameSystem gameSystem = new GameSystem();
Entity entity = new Entity("MyEntity");
entity.setGameSystem(gameSystem);

assertEquals(gameSystem, entity.getGameSystem(), "The game system should match the one set.");
}

@Test
void testUpdate_whenEntityDisabled_shouldReturnImmediately() {

Expand Down

0 comments on commit f92c2a4

Please sign in to comment.