Java 类com.badlogic.gdx.ai.steer.behaviors.Wander 实例源码

项目:gdxjam-ugg    文件:WatcherConfig.java   
@Override
public void applyConfigs(SteeringBehaviorComponent steeringBC) {
    Wander wander = (Wander)steeringBC.behavior;
    Steerable steerable = wander.getOwner();
    steerable.setMaxLinearSpeed(MAX_LINEAR_SPEED);
    steerable.setMaxLinearAcceleration(MAX_LINEAR_ACCELERATION);
    steerable.setMaxAngularSpeed(MAX_ANGULAR_SPEED);
    steerable.setMaxAngularAcceleration(MAX_ANGULAR_ACCELERATION);

    wander.setWanderRadius(0.1f);
    wander.setTimeToTarget(0.1f);
    wander.setDecelerationRadius(1f);
    wander.setFaceEnabled(false);
    wander.setWanderOrientation(250f);

}
项目:gdxjam-ugg    文件:WatcherSlowerConfig.java   
@Override
public void applyConfigs(SteeringBehaviorComponent steeringBC) {
    Wander wander = (Wander)steeringBC.behavior;
    Steerable steerable = wander.getOwner();
    steerable.setMaxLinearSpeed(MAX_LINEAR_SPEED);
    steerable.setMaxLinearAcceleration(MAX_LINEAR_ACCELERATION);
    steerable.setMaxAngularSpeed(MAX_ANGULAR_SPEED);
    steerable.setMaxAngularAcceleration(MAX_ANGULAR_ACCELERATION);

    wander.setWanderRadius(0.1f);
    wander.setTimeToTarget(0.1f);
    wander.setDecelerationRadius(0f);
    wander.setFaceEnabled(false);
    wander.setWanderOrientation(250f);

}
项目:gdxjam-ugg    文件:WanderConfig.java   
@Override
public void applyConfigs(SteeringBehaviorComponent steeringBC) {
    Wander wander = (Wander)steeringBC.behavior;
    Steerable steerable = wander.getOwner();
    steerable.setMaxLinearSpeed(MAX_LINEAR_SPEED);
    steerable.setMaxLinearAcceleration(MAX_LINEAR_ACCELERATION);
    steerable.setMaxAngularSpeed(MAX_ANGULAR_SPEED);
    steerable.setMaxAngularAcceleration(MAX_ANGULAR_ACCELERATION);
    //wander.setTarget(loc);
    wander.setWanderRadius(5f);
    wander.setTimeToTarget(0.1f);
    wander.setDecelerationRadius(3f);
    wander.setFaceEnabled(false);
    wander.setWanderOrientation(250f);

}
项目:GdxDemo3D    文件:WanderSteerer.java   
public WanderSteerer(final SteerableBody steerableBody) {
    super(steerableBody);

    this.wanderSB = new Wander<Vector3>(steerableBody) {
        @Override
        protected SteeringAcceleration<Vector3> calculateRealSteering(SteeringAcceleration<Vector3> steering) {
            super.calculateRealSteering(steering);
            steering.linear.y = 0; // remove any vertical acceleration
            return steering;
        }
    };
    this.wanderSB.setWanderOffset(8) //
        .setWanderOrientation(0) //
        .setWanderRadius(0.5f) //
        .setWanderRate(MathUtils.PI2 * 4);

    this.prioritySteering.add(wanderSB);
}
项目:Pacman_libGdx    文件:GhostAI.java   
private void createWanderBehavior() {
    wanderBehavior = new Wander<>(this)
            .setEnabled(true)
            .setWanderRadius(2f)
            .setWanderRate(MathUtils.PI2 * 4);
}
项目:gdx-ai    文件:Scene2dPursueTest.java   
@Override
public void create () {
    super.create();

    character = new SteeringActor(container.badlogicSmall, false);
    character.setPosition(MathUtils.random(container.stageWidth), MathUtils.random(container.stageHeight), Align.center);
    character.setMaxLinearSpeed(100);
    character.setMaxLinearAcceleration(600);

    prey = new SteeringActor(container.target, false);
    prey.setPosition(MathUtils.random(container.stageWidth), MathUtils.random(container.stageHeight), Align.center);
    prey.setMaxLinearSpeed(100);
    prey.setMaxLinearAcceleration(250);
    prey.setMaxAngularAcceleration(0); // used by Wander; set to 0 because independent facing is disabled
    prey.setMaxAngularSpeed(5);

    final Pursue<Vector2> pursueSB = new Pursue<Vector2>(character, prey, 0.3f);
    character.setSteeringBehavior(pursueSB);

    Wander<Vector2> wanderSB = new Wander<Vector2>(prey) //
        // Don't use Face internally because independent facing is off
        .setFaceEnabled(false) //
        // No need to call setAlignTolerance, setDecelerationRadius and setTimeToTarget for the same reason
        .setWanderOffset(110) //
        .setWanderOrientation(10) //
        .setWanderRadius(64) //
        .setWanderRate(MathUtils.PI2 * 3.5f);
    prey.setSteeringBehavior(wanderSB);

    testTable.addActor(character);
    testTable.addActor(prey);

    Table detailTable = new Table(container.skin);

    detailTable.row();
    addMaxLinearAccelerationController(detailTable, character, 0, 2000, 20);

    detailTable.row();
    final Label labelMaxPredictionTime = new Label("Max.Prediction Time[" + pursueSB.getMaxPredictionTime() + "] sec.",
        container.skin);
    detailTable.add(labelMaxPredictionTime);
    detailTable.row();
    Slider maxPredictionTime = new Slider(0, 5, .1f, false, container.skin);
    maxPredictionTime.setValue(pursueSB.getMaxPredictionTime());
    maxPredictionTime.addListener(new ChangeListener() {
        @Override
        public void changed (ChangeEvent event, Actor actor) {
            Slider slider = (Slider)actor;
            pursueSB.setMaxPredictionTime(slider.getValue());
            labelMaxPredictionTime.setText("Max.Prediction Time [" + slider.getValue() + "] sec.");
        }
    });
    detailTable.add(maxPredictionTime);

    detailTable.row();
    addSeparator(detailTable);

    detailTable.row();
    addMaxLinearSpeedController(detailTable, character, 0, 300, 10);

    detailWindow = createDetailWindow(detailTable);
}