List of usage examples for com.badlogic.gdx.ai.steer.proximities InfiniteProximity InfiniteProximity
public InfiniteProximity(Steerable<T> owner, Array<? extends Steerable<T>> agents)
From source file:toniarts.openkeeper.world.creature.CreatureControl.java
License:Open Source License
/** * Set follow mode//from w w w.j a va 2s . c o m * * @param target the target to follow * @return true if it is valid to follow it */ public boolean followTarget(CreatureControl target) { if (target != null) { followTarget = target; PrioritySteering<Vector2> prioritySteering = new PrioritySteering(this, 0.0001f); // Create proximity Array<CreatureControl> creatures; if (party != null) { creatures = new Array<>(party.getActualMembers().size()); for (CreatureControl cr : party.getActualMembers()) { creatures.add(cr); } } else { creatures = new Array<>(2); creatures.add(target); creatures.add(this); } // Hmm, proximity should be the same instance? Gotten from the party? Cohesion<Vector2> cohersion = new Cohesion<>(this, new InfiniteProximity<Vector2>(this, creatures)); prioritySteering.add(cohersion); setSteeringBehavior(prioritySteering); return true; } return false; }