Ejemplo n.º 1
0
 public static boolean hasArrived(Entity entity) {
   EnemyMovement enemyMovement = EntityUtil.getComponent(entity, EnemyMovement.class);
   Vector2 intent = enemyMovement.getIntent().cpy();
   Vector2 position = PhysicsUtil.getPosition(entity);
   intent.y = position.y;
   return position.epsilonEquals(intent, Constants.GAME.EPSILON);
 }
Ejemplo n.º 2
0
 public static void drag(Entity enemy, Vector2 target, float force, int duration) {
   EnemyMovement movement = EntityUtil.getComponent(enemy, EnemyMovement.class);
   if (movement != null) {
     movement.setDraggedTo(target);
     movement.setDragForce(force);
     movement.setDragDuration(duration);
     movement.setStartDrag(TimeUtil.getGameTime());
     movement.setDraggedFrom(PhysicsUtil.getPosition(enemy));
   }
 }
Ejemplo n.º 3
0
 public static void setTarget(Entity enemy, Vector2 target) {
   EnemyMovement movement = EntityUtil.getComponent(enemy, EnemyMovement.class);
   if (movement != null) {
     movement.setIntent(target);
   }
 }