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

Java State类代码示例

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

本文整理汇总了Java中com.badlogic.gdx.ai.fsm.State的典型用法代码示例。如果您正苦于以下问题:Java State类的具体用法?Java State怎么用?Java State使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



State类属于com.badlogic.gdx.ai.fsm包,在下文中一共展示了State类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleMessage

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean handleMessage(Telegram msg) {
	if (msg.message == MessageType.YOU_ARE_DISMANTLED.ordinal()) {
		kill();
		Vector3 p = Game.instance.activeIsland.pos;
		ItemDrop i = new ItemDrop(Island.SIZE / 2 - 5, Island.SIZE / 4 * 3 + p.y + 1, Island.SIZE / 2, Item.get("YELLOW_CRYSTAL"), 1);
		island.addEntity(i, false, false);
		return true;
	}
	
	if (msg.message == MessageType.STRUCTURE_BROADCAST_HANDLED.ordinal()) {
		requestedHumanStates.removeValue((State<Human>) msg.extraInfo, true);
	}
	
	return false;
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:18,代码来源:Structure.java


示例2: changeState

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
public <T extends State> GameEntity changeState(T state){
    if(fsmC == null) fsmC = Mappers.fsm.get(this.entity);
    if(fsmC != null && fsmC.stateMachine.getCurrentState() != state){
        fsmC.stateMachine.changeState(state);
    }
    return this;
}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:8,代码来源:GameEntity.java


示例3: Structure

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
public Structure(float x, float y, float z, String model) {
	super(Math.round(x), Math.round(y), Math.round(z), model);
	
	nodes = new Array<StructureNode>();
	workers = new Array<Human>();
	
	int width = (int) Math.ceil(boundingBox.getDimensions().x);
	int depth = (int) Math.ceil(boundingBox.getDimensions().z);
	
	nodes.add(new StructureNode(NodeType.target, -1, 0, Math.round(depth / 2)));
	nodes.add(new StructureNode(NodeType.target, width, 0, Math.round(depth / 2)));
	nodes.add(new StructureNode(NodeType.target, Math.round(width / 2), 0, -1));
	nodes.add(new StructureNode(NodeType.target, Math.round(width / 2), 0, depth));
	
	nodes.add(new StructureNode(NodeType.build, 0, 0, Math.round(depth / 2)));
	nodes.add(new StructureNode(NodeType.build, width - 1, 0, Math.round(depth / 2)));
	nodes.add(new StructureNode(NodeType.build, Math.round(width / 2), 0, 0));
	nodes.add(new StructureNode(NodeType.build, Math.round(width / 2), 0, depth - 1));
	
	inventory = new Inventory();
	buildInventory = new NonStackingInventory(256 /* That should be enough... */);
	costs = new ResourceList();
	requestedHumanStates = new Array<State<Human>>();
	handledHumanStates = new Array<State<Human>>();
	tasks = new Array<Task>();
	taskQueue = new Array<Task>();
	working = true;
	
	dimensions.x++;
	dimensions.z++;
	
	setBuilt(false);
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:34,代码来源:Structure.java


示例4: broadcast

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
public void broadcast(float delay, State<Human> requestedState, Object... params) {
	Array<Object> array = new Array<Object>(params);
	array.insert(0, this);
	
	if (!requestedHumanStates.contains(requestedState, true)) requestedHumanStates.add(requestedState);
	
	MessageDispatcher.getInstance().dispatchMessage(delay, this, null, MessageType.STRUCTURE_BROADCAST.ordinal(), new BroadcastPayload(requestedState, array.items));
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:9,代码来源:Structure.java


示例5: changeState

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
public void changeState(State<Human> newState, Object... params) {
	previousStateParams.clear();
	previousStateParams.addAll(stateParams);
	stateParams.clear();
	stateParams.addAll(params);
	stateMachine.changeState(newState);
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:8,代码来源:Human.java


示例6: Entity

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
public Entity(final GraphicsProcessor graphics, final PhysicsProcessor physics, final AudioProcessor audio,
		final State<Entity> initialState) {
	this.graphics = graphics;
	this.physics = physics;
	this.audio = audio;
	stateMachine = new DefaultStateMachine<Entity>(this, initialState);
}
 
开发者ID:nfantone,项目名称:ninja-rabbit,代码行数:8,代码来源:Entity.java


示例7: getCurrentState

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
public State getCurrentState(){
    if(fsmC == null) fsmC = Mappers.fsm.get(this.entity);
    return fsmC == null? null : fsmC.stateMachine.getCurrentState();
}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:5,代码来源:GameEntity.java


示例8: changeState

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
public void changeState (State<GameEntity> state) {
	stateMachine.changeState(state);
}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:4,代码来源:FSMComponent.java


示例9: Tatics

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
private Tatics(State<Entity> entryState){
	this.entryState = entryState;
}
 
开发者ID:libgdx-jam,项目名称:GDXJam,代码行数:4,代码来源:SquadTatics.java


示例10: changeState

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
public void changeState (State<Entity> state) {
	stateMachine.changeState(state);
}
 
开发者ID:libgdx-jam,项目名称:GDXJam,代码行数:4,代码来源:FSMComponent.java


示例11: getWorkerState

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
public State<Human> getWorkerState() {
	return workerState;
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:4,代码来源:Structure.java


示例12: getState

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
public State<Human> getState() {
	return stateMachine.getCurrentState();
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:4,代码来源:Human.java


示例13: SyncedStateMachine

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
public SyncedStateMachine(E owner, State<E> initialState) {
	super(owner, initialState);
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:4,代码来源:SyncedStateMachine.java


示例14: changeState

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
@Override
public void changeState(State<E> newState) {
	newStateEntered = false;
	super.changeState(newState);
	newStateEntered = true;
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:7,代码来源:SyncedStateMachine.java


示例15: BroadcastPayload

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
public BroadcastPayload(State<Human> state, Object... params) {
	this.state = state;
	this.params = params;
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:5,代码来源:BroadcastPayload.java


示例16: changeState

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
/**
 * Sets a new {@link State} for this {@link Entity} to be performed in the next execution step
 * for this character.
 *
 * @see StateMachine#changeState(State)
 *
 * @param newState
 *            The state to make the transition to. Each {@link Entity} may define its own.
 *
 */
public void changeState(final State<Entity> newState) {
	stateMachine.changeState(newState);
}
 
开发者ID:nfantone,项目名称:ninja-rabbit,代码行数:14,代码来源:Entity.java


示例17: isInState

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
/**
 * Whether this entity is performing the given state or not.
 *
 * @see StateMachine#isInState(State)
 * @param state
 *            The state to test against the current actions of the entity.
 * @return true if this entity is executing the state; false, otherwise.
 */
public boolean isInState(final State<Entity> state) {
	return state != null && stateMachine.isInState(state);
}
 
开发者ID:nfantone,项目名称:ninja-rabbit,代码行数:12,代码来源:Entity.java


示例18: getCurrentState

import com.badlogic.gdx.ai.fsm.State; //导入依赖的package包/类
/**
 * Returns the current state of this {@link Entity}.
 *
 * @see StateMachine#getCurrentState()
 * @return The {@link State} this entity is currently in.
 */
public State<Entity> getCurrentState() {
	return stateMachine.getCurrentState();
}
 
开发者ID:nfantone,项目名称:ninja-rabbit,代码行数:10,代码来源:Entity.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Context类代码示例发布时间:2022-05-22
下一篇:
Java AbstractPacket类代码示例发布时间: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