List of usage examples for com.badlogic.gdx.ai.steer.behaviors PrioritySteering setEnabled
@Override
public PrioritySteering<T> setEnabled(boolean enabled)
From source file:toniarts.openkeeper.world.creature.CreatureControl.java
License:Open Source License
public void navigateToRandomPoint() { Point p = worldState.findRandomAccessibleTile( worldState.getTileCoordinates(getSpatial().getWorldTranslation()), 10, creature); if (p != null) { GraphPath<TileData> outPath = worldState .findPath(worldState.getTileCoordinates(getSpatial().getWorldTranslation()), p, creature); if (outPath != null && outPath.getCount() > 1) { // Debug // worldHandler.drawPath(new LinePath<>(pathToArray(outPath))); PrioritySteering<Vector2> prioritySteering = new PrioritySteering(this, 0.0001f); FollowPath<Vector2, LinePathParam> followPath = new FollowPath(this, new LinePath<>(pathToArray(outPath), true), 2); followPath.setDecelerationRadius(1f); followPath.setArrivalTolerance(0.2f); prioritySteering.add(followPath); prioritySteering.setEnabled(!isAnimationPlaying()); setSteeringBehavior(prioritySteering); }/*w w w. j a v a2s . c om*/ } }
From source file:toniarts.openkeeper.world.creature.CreatureControl.java
License:Open Source License
public void navigateToAssignedTask() { Vector2f loc = assignedTask.getTarget(this); if (loc != null) { GraphPath<TileData> outPath = worldState.findPath( worldState.getTileCoordinates(getSpatial().getWorldTranslation()), new Point((int) Math.floor(loc.x), (int) Math.floor(loc.y)), creature); if (outPath != null && outPath.getCount() > 1) { // Debug // worldHandler.drawPath(new LinePath<>(pathToArray(outPath))); PrioritySteering<Vector2> prioritySteering = new PrioritySteering(this, 0.0001f); FollowPath<Vector2, LinePathParam> followPath = new FollowPath(this, new LinePath<>(pathToArray(outPath), true), 2); followPath.setDecelerationRadius(1f); followPath.setArrivalTolerance(0.2f); prioritySteering.add(followPath); prioritySteering.setEnabled(!isAnimationPlaying()); setSteeringBehavior(prioritySteering); }/* w w w. ja v a2s .c o m*/ } }