Search in sources :

Example 6 with TestEntity

use of ilargia.entitas.utils.TestEntity in project Entitas-Java by Rubentxu.

the class ContextTest method updateGroupsComponentAddedOrRemovedTest.

@Test
public void updateGroupsComponentAddedOrRemovedTest() {
    Position position = new Position();
    Group<TestEntity> group = context.getGroup(TestMatcher.Position());
    group.OnEntityAdded((g, e, idx, pc) -> assertEquals(TestComponentIds.Position, idx));
    entity.addComponent(TestComponentIds.Position, position);
    context.updateGroupsComponentAddedOrRemoved(entity, TestComponentIds.Position, position, context._groupsForIndex);
    context.updateGroupsComponentAddedOrRemoved(entity, TestComponentIds.Position, position, context._groupsForIndex);
//context.OnGroupCleared = (context, group)->  assertNull(context.OnEntityCreated);
}
Also used : TestEntity(ilargia.entitas.utils.TestEntity) Position(ilargia.entitas.components.Position) Test(org.junit.Test)

Example 7 with TestEntity

use of ilargia.entitas.utils.TestEntity in project Entitas-Java by Rubentxu.

the class GroupTest method setUp.

@Before
public void setUp() throws Exception {
    createCollections();
    entity = new TestEntity();
    entity.initialize(0, 10, new Stack[10], new ContextInfo("Test", TestComponentIds.componentNames(), TestComponentIds.componentTypes()), null);
    entity.clearEventsListener();
    entity.reactivate(0);
    entity.addComponent(TestComponentIds.Position, new Position(100, 100));
    entity.addComponent(TestComponentIds.View, new View(1));
    group = new Group<TestEntity>(TestMatcher.Position(), TestEntity.class);
    group2 = new Group(TestMatcher.Interactive(), Entity.class);
}
Also used : TestEntity(ilargia.entitas.utils.TestEntity) Group(ilargia.entitas.group.Group) TestEntity(ilargia.entitas.utils.TestEntity) Position(ilargia.entitas.components.Position) View(ilargia.entitas.components.View) ContextInfo(ilargia.entitas.api.ContextInfo) Before(org.junit.Before)

Aggregations

TestEntity (ilargia.entitas.utils.TestEntity)7 Test (org.junit.Test)5 Position (ilargia.entitas.components.Position)4 ContextInfo (ilargia.entitas.api.ContextInfo)2 View (ilargia.entitas.components.View)2 Before (org.junit.Before)2 IComponent (ilargia.entitas.api.IComponent)1 IGroup (ilargia.entitas.api.IGroup)1 EntitasCache (ilargia.entitas.caching.EntitasCache)1 Group (ilargia.entitas.group.Group)1