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