本文整理汇总了Java中com.badlogic.gdx.ai.steer.behaviors.Wander类的典型用法代码示例。如果您正苦于以下问题:Java Wander类的具体用法?Java Wander怎么用?Java Wander使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Wander类属于com.badlogic.gdx.ai.steer.behaviors包,在下文中一共展示了Wander类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyConfigs
import com.badlogic.gdx.ai.steer.behaviors.Wander; //导入依赖的package包/类
@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);
}
示例2: applyConfigs
import com.badlogic.gdx.ai.steer.behaviors.Wander; //导入依赖的package包/类
@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);
}
示例3: applyConfigs
import com.badlogic.gdx.ai.steer.behaviors.Wander; //导入依赖的package包/类
@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);
}
示例4: WanderSteerer
import com.badlogic.gdx.ai.steer.behaviors.Wander; //导入依赖的package包/类
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);
}
示例5: createWanderBehavior
import com.badlogic.gdx.ai.steer.behaviors.Wander; //导入依赖的package包/类
private void createWanderBehavior() {
wanderBehavior = new Wander<>(this)
.setEnabled(true)
.setWanderRadius(2f)
.setWanderRate(MathUtils.PI2 * 4);
}
示例6: create
import com.badlogic.gdx.ai.steer.behaviors.Wander; //导入依赖的package包/类
@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);
}