Search in sources :

Example 1 with IEntity

use of ilargia.entitas.api.entitas.IEntity in project Entitas-Java by Rubentxu.

the class EntityTest method OnComponentAddedTest.

@Test
public void OnComponentAddedTest() {
    entity.OnComponentAdded((IEntity e, int index, IComponent c) -> assertEquals(TestComponentIds.Motion, index));
    entity.addComponent(TestComponentIds.Motion, new Motion(100, 100));
}
Also used : Motion(ilargia.entitas.components.Motion) IEntity(ilargia.entitas.api.entitas.IEntity) IComponent(ilargia.entitas.api.IComponent) Test(org.junit.Test)

Example 2 with IEntity

use of ilargia.entitas.api.entitas.IEntity in project Entitas-Java by Rubentxu.

the class EntityTest method OnComponentReplacedTest.

@Test
public void OnComponentReplacedTest() {
    entity.OnComponentReplaced((IEntity e, int index, IComponent c, IComponent n) -> assertEquals(33F, ((Position) n).x, 0.1f));
    entity.replaceComponent(TestComponentIds.Position, new Position(33, 100));
}
Also used : IEntity(ilargia.entitas.api.entitas.IEntity) Position(ilargia.entitas.components.Position) IComponent(ilargia.entitas.api.IComponent) Test(org.junit.Test)

Aggregations

IComponent (ilargia.entitas.api.IComponent)2 IEntity (ilargia.entitas.api.entitas.IEntity)2 Test (org.junit.Test)2 Motion (ilargia.entitas.components.Motion)1 Position (ilargia.entitas.components.Position)1