Search in sources :

Example 1 with Motion

use of ilargia.entitas.components.Motion in project Entitas-Java by Rubentxu.

the class EntityTest method replaceNotExistComponentTest.

@Test
public void replaceNotExistComponentTest() {
    entity.replaceComponent(TestComponentIds.Motion, new Motion(50F, 50F));
    assertEquals(50F, ((Motion) entity.getComponent(TestComponentIds.Motion)).x, 0.1F);
}
Also used : Motion(ilargia.entitas.components.Motion) Test(org.junit.Test)

Example 2 with Motion

use of ilargia.entitas.components.Motion in project Entitas-Java by Rubentxu.

the class EntityTest method falseReplaceComponentTest.

@Test
public void falseReplaceComponentTest() {
    entity.replaceComponent(TestComponentIds.Motion, new Motion(50F, 50F));
    assertNotEquals(100F, ((Motion) entity.getComponent(TestComponentIds.Motion)).x, 0.1F);
}
Also used : Motion(ilargia.entitas.components.Motion) Test(org.junit.Test)

Example 3 with Motion

use of ilargia.entitas.components.Motion 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)

Aggregations

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