• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Wander类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MapTypeIdEnum类代码示例发布时间:2022-05-22
下一篇:
Java IMutation类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap