当前位置: 首页>>代码示例>>Java>>正文


Java Wander类代码示例

本文整理汇总了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);

}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:17,代码来源:WatcherConfig.java

示例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);

}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:17,代码来源:WatcherSlowerConfig.java

示例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);

}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:17,代码来源:WanderConfig.java

示例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);
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:19,代码来源:WanderSteerer.java

示例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);
}
 
开发者ID:yichen0831,项目名称:Pacman_libGdx,代码行数:7,代码来源:GhostAI.java

示例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);
}
 
开发者ID:libgdx,项目名称:gdx-ai,代码行数:63,代码来源:Scene2dPursueTest.java


注:本文中的com.badlogic.gdx.ai.steer.behaviors.Wander类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。