Skip to content

Commit c3ef23c

Browse files
committed
even more issues fixed
1 parent 7c2b6a2 commit c3ef23c

File tree

4 files changed

+2
-33
lines changed

4 files changed

+2
-33
lines changed

Diff for: entity-component-system/src/main/java/com/iluwatar/Entity.java

-19
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public class Entity {
4040
private boolean isEnabled;
4141
private TransformComponent transform;
4242
private Entity parent;
43-
private GameSystem gameSystem;
4443
private List<Component> components;
4544
private List<Entity> children;
4645

@@ -262,24 +261,6 @@ public void setIsEnabled(boolean isEnabled) {
262261
}
263262
}
264263

265-
/**
266-
* Gets the game system this entity belongs to.
267-
*
268-
* @return the game system the entity is part of
269-
*/
270-
public GameSystem getGameSystem() {
271-
return gameSystem;
272-
}
273-
274-
/**
275-
* Sets the game system this entity belongs to.
276-
*
277-
* @param gameSystem the game system to set
278-
*/
279-
public void setGameSystem(GameSystem gameSystem) {
280-
this.gameSystem = gameSystem;
281-
}
282-
283264
/**
284265
* Gets the parent entity of this entity.
285266
*

Diff for: entity-component-system/src/main/java/com/iluwatar/GameSystem.java

-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ public GameSystem() {
5151
public void addEntity(Entity entity) {
5252
if (entity != null) {
5353
entities.add(entity);
54-
entity.setGameSystem(this);
55-
5654
// Recursively add children entities
5755
for (Entity child : entity.getChildren()) {
5856
addEntity(child);

Diff for: entity-component-system/src/test/java/com/iluwatar/AppTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ void testFinalEntityStateAfterSimulation() {
106106
GameSystem gameSystem = new GameSystem();
107107
gameSystem.addEntity(entity1);
108108
gameSystem.addEntity(entity2);
109-
TransformComponent TestTransform = new TransformComponent(new float[]{5.0f, 0.0f, 0.0f},
109+
TransformComponent testTransform = new TransformComponent(new float[]{5.0f, 0.0f, 0.0f},
110110
new float[]{0.0f, 45.0f, 0.0f}, new float[]{1.0f, 1.0f, 1.0f});
111-
entity1.setTransformComponent(TestTransform);
111+
entity1.setTransformComponent(testTransform);
112112

113113
for (int i = 0; i < 10; i++) {
114114
gameSystem.update(1.0f / 60.0f);

Diff for: entity-component-system/src/test/java/com/iluwatar/EntityTest.java

-10
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,6 @@ void testSetIsEnabled() {
154154
assertTrue(entityChild.isEnabled(), "The entity child should be enabled after calling setIsEnabled(true).");
155155
}
156156

157-
@Test
158-
void testGetAndSetGameSystem() {
159-
160-
GameSystem gameSystem = new GameSystem();
161-
Entity entity = new Entity("MyEntity");
162-
entity.setGameSystem(gameSystem);
163-
164-
assertEquals(gameSystem, entity.getGameSystem(), "The game system should match the one set.");
165-
}
166-
167157
@Test
168158
void testUpdate_whenEntityDisabled_shouldReturnImmediately() {
169159

0 commit comments

Comments
 (0)