Package com.badlogic.ashley.core

Examples of com.badlogic.ashley.core.Entity


    engine.addSystem(new IteratingRemovalSystem());
   
    final int numEntities = 10;
   
    for (int i = 0; i < numEntities; ++i) {
      Entity e = new Entity();
      e.add(new SpyComponent());
      e.add(new OrderComponent("" + i, i));
     
      IndexComponent in = new IndexComponent();
      in.index = i + 1;
     
      e.add(in);
     
      engine.addEntity(e);
    }
   
    engine.update(deltaTime);
   
    assertEquals(numEntities / 2, entities.size());
   
    for (int i = 0; i < entities.size(); ++i) {
      Entity e = entities.get(i);
     
      assertEquals(1, sm.get(e).updates);
    }
  }
View Full Code Here


    engine.addSystem(new IteratingComponentRemovalSystem());
   
    final int numEntities = 10;
   
    for (int i = 0; i < numEntities; ++i) {
      Entity e = new Entity();
      e.add(new SpyComponent());
      e.add(new OrderComponent("" + i, i));
     
      IndexComponent in = new IndexComponent();
      in.index = i + 1;
     
      e.add(in);
     
      engine.addEntity(e);
    }
   
    engine.update(deltaTime);
   
    assertEquals(numEntities / 2, entities.size());
   
    for (int i = 0; i < entities.size(); ++i) {
      Entity e = entities.get(i);
     
      assertEquals(1, sm.get(e).updates);
    }
  }
View Full Code Here

      assertEquals(1, sm.get(e).updates);
    }
  }
 
  private static Entity createOrderEntity(String name, int zLayer) {
    Entity entity = new Entity();
    entity.add(new OrderComponent(name, zLayer));
    return entity;
  }
View Full Code Here

   
    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);
   
    engine.addEntity(a);
    engine.addEntity(b);
    engine.addEntity(c);
    system.expectedNames.addLast("A");
View Full Code Here

     
      engine = new PooledEngine();
      engine.addSystem(new RenderSystem(camera));
      engine.addSystem(new MovementSystem());
     
      Entity crate = engine.createEntity();
      crate.add(new PositionComponent(50, 50));
      crate.add(new VisualComponent(new TextureRegion(crateTexture)));

      engine.addEntity(crate);
     
      TextureRegion coinRegion = new TextureRegion(coinTexture);
     
      for(int i=0; i<100; i++){
        Entity coin = engine.createEntity();
        coin.add(new PositionComponent(MathUtils.random(640), MathUtils.random(480)));
        coin.add(new MovementComponent(10.0f, 10.0f));
        coin.add(new VisualComponent(coinRegion));
        engine.addEntity(coin);
      }
    }
View Full Code Here

TOP

Related Classes of com.badlogic.ashley.core.Entity

Copyright © 2018 www.massapicom. 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.