Package com.badlogic.ashley.core

Examples of com.badlogic.ashley.core.Engine.addSystem()


  public static void main(String[] args){
    Engine engine = new Engine();
   
    engine.addSystem(new SystemA(10));
    engine.addSystem(new SystemB(5));
    engine.addSystem(new SystemA(2));
   
    engine.update(0);
  }
 
  public static class SystemA extends EntitySystem {
View Full Code Here


    final Family family = Family.getFor(OrderComponent.class, ComponentB.class);
    final SortedIteratingSystemMock system = new SortedIteratingSystemMock(family);
    final Entity e = new Entity();

    engine.addSystem(system);
    engine.addEntity(e);
   
    //When entity has OrderComponent
    e.add(new OrderComponent("A", 0));
    engine.update(deltaTime);
View Full Code Here

  public void entityRemovalWhileIterating(){
    Engine engine = new Engine();
    ImmutableArray<Entity> entities = engine.getEntitiesFor(Family.getFor(SpyComponent.class, IndexComponent.class));
    ComponentMapper<SpyComponent> sm = ComponentMapper.getFor(SpyComponent.class);
   
    engine.addSystem(new IteratingRemovalSystem());
   
    final int numEntities = 10;
   
    for (int i = 0; i < numEntities; ++i) {
      Entity e = new Entity();
View Full Code Here

  public void componentRemovalWhileIterating(){
    Engine engine = new Engine();
    ImmutableArray<Entity> entities = engine.getEntitiesFor(Family.getFor(SpyComponent.class, IndexComponent.class));
    ComponentMapper<SpyComponent> sm = ComponentMapper.getFor(SpyComponent.class);
   
    engine.addSystem(new IteratingComponentRemovalSystem());
   
    final int numEntities = 10;
   
    for (int i = 0; i < numEntities; ++i) {
      Entity e = new Entity();
View Full Code Here

  public void entityOrder(){
    Engine engine = new Engine();
   
    final Family family = Family.getFor(OrderComponent.class);
    final SortedIteratingSystemMock system = new SortedIteratingSystemMock(family);
    engine.addSystem(system);
   
    Entity a = createOrderEntity("A", 0);
    Entity b = createOrderEntity("B", 1);
    Entity c = createOrderEntity("C", 3);
    Entity d = createOrderEntity("D", 2);
View Full Code Here

    @Test
    public void intervalSystem(){
        Engine engine = new Engine();
        IntervalSystemSpy intervalSystemSpy = new IntervalSystemSpy();
       
        engine.addSystem(intervalSystemSpy);

        for (int i = 1; i <= 10; ++i) {
          engine.update(deltaTime);
          assertEquals(i / 2, intervalSystemSpy.numUpdates);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.