Search in sources :

Example 6 with Position

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

the class SystemsTest method addReactiveSystemTest.

@Test
public void addReactiveSystemTest() {
    TestReactive reactiveSystem = new TestReactive(context);
    systems.add(reactiveSystem);
    systems.activateReactiveSystems();
    context.createEntity().addComponent(TestComponentIds.Position, new Position(100, 100));
    systems.execute(1);
// assertTrue(reactiveSystem.flagExecute);
}
Also used : Position(ilargia.entitas.components.Position) Test(org.junit.Test)

Example 7 with Position

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

the class EntityTest method notEnabled3.

@Test(expected = EntityIsNotEnabledException.class)
public void notEnabled3() {
    entity.destroy();
    entity.replaceComponent(TestComponentIds.Position, new Position(100, 100));
}
Also used : Position(ilargia.entitas.components.Position) Test(org.junit.Test)

Example 8 with Position

use of ilargia.entitas.components.Position 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 9 with Position

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

the class EntityTest method notEnabled.

@Test(expected = EntityIsNotEnabledException.class)
public void notEnabled() {
    entity.destroy();
    entity.addComponent(TestComponentIds.Position, new Position(100, 100));
}
Also used : Position(ilargia.entitas.components.Position) Test(org.junit.Test)

Example 10 with Position

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

the class EntityTest method setUp.

@Before
public void setUp() throws Exception {
    createCollections();
    _componentPools = new Stack[10];
    EntitasCache cache = new EntitasCache();
    entity = new TestEntity();
    entity.initialize(0, 10, _componentPools, new ContextInfo("Test", TestComponentIds.componentNames(), TestComponentIds.componentTypes()));
    entity.clearEventsListener();
    entity.reactivate(0);
    entity.addComponent(TestComponentIds.Position, new Position(100, 100));
    entity.addComponent(TestComponentIds.View, new View(1));
}
Also used : TestEntity(ilargia.entitas.utils.TestEntity) EntitasCache(ilargia.entitas.caching.EntitasCache) Position(ilargia.entitas.components.Position) View(ilargia.entitas.components.View) ContextInfo(ilargia.entitas.api.ContextInfo) Before(org.junit.Before)

Aggregations

Position (ilargia.entitas.components.Position)17 Test (org.junit.Test)15 TestEntity (ilargia.entitas.utils.TestEntity)6 IGroup (ilargia.entitas.api.IGroup)5 Group (ilargia.entitas.group.Group)5 IComponent (ilargia.entitas.api.IComponent)4 IEntity (ilargia.entitas.api.entitas.IEntity)3 ContextInfo (ilargia.entitas.api.ContextInfo)2 View (ilargia.entitas.components.View)2 PrimaryEntityIndex (ilargia.entitas.index.PrimaryEntityIndex)2 Before (org.junit.Before)2 EntitasCache (ilargia.entitas.caching.EntitasCache)1