Search in sources :

Example 6 with IComponent

use of ilargia.entitas.api.IComponent 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)

Example 7 with IComponent

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

the class ContextTest method clearComponentPoolsTest.

@Test
public void clearComponentPoolsTest() {
    Stack[] cpool = context.getComponentPools();
    cpool[0] = new Stack<IComponent>();
    cpool[0].push(new Position());
    assertEquals(1, cpool[0].size());
    context.clearComponentPools();
    assertTrue(cpool[0].empty());
}
Also used : Position(ilargia.entitas.components.Position) IComponent(ilargia.entitas.api.IComponent) Test(org.junit.Test)

Example 8 with IComponent

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

the class ContextTest method clearComponentPoolTest.

@Test
public void clearComponentPoolTest() {
    Stack[] cpool = context.getComponentPools();
    cpool[0] = new Stack<IComponent>();
    cpool[0].push(new Position());
    assertEquals(1, cpool[0].size());
    context.clearComponentPool(0);
    assertTrue(cpool[0].empty());
}
Also used : Position(ilargia.entitas.components.Position) IComponent(ilargia.entitas.api.IComponent) Test(org.junit.Test)

Aggregations

IComponent (ilargia.entitas.api.IComponent)8 Test (org.junit.Test)5 Position (ilargia.entitas.components.Position)4 IEntity (ilargia.entitas.api.entitas.IEntity)2 EntityFactory (ilargia.egdx.api.factories.EntityFactory)1 SceneManager (ilargia.egdx.api.managers.SceneManager)1 CChainLight (ilargia.egdx.logicbricks.component.scene.CChainLight)1 CConeLight (ilargia.egdx.logicbricks.component.scene.CConeLight)1 CDirectionalLight (ilargia.egdx.logicbricks.component.scene.CDirectionalLight)1 CPointLight (ilargia.egdx.logicbricks.component.scene.CPointLight)1 IGroup (ilargia.entitas.api.IGroup)1 EntitasException (ilargia.entitas.api.entitas.EntitasException)1 Motion (ilargia.entitas.components.Motion)1 TestEntity (ilargia.entitas.utils.TestEntity)1