Java 类com.badlogic.gdx.ai.msg.MessageDispatcher 实例源码

项目:Inspiration    文件:PathFinderRequest.java   
/** Creates a {@code PathFinderRequest} with the given arguments. */
public PathFinderRequest (N startNode, N endNode, Heuristic<N> heuristic, GraphPath<N> resultPath, MessageDispatcher dispatcher) {
    this.startNode = startNode;
    this.endNode = endNode;
    this.heuristic = heuristic;
    this.resultPath = resultPath;
    this.dispatcher = dispatcher;

    this.executionFrames = 0;
    this.pathFound = false;
    this.status = SEARCH_NEW;
    this.statusChanged = false;
}
项目:Vloxlands    文件:Structure.java   
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));
}
项目:Vloxlands    文件:Human.java   
public Human(float x, float y, float z) {
    super(x, y, z, "creature/humanblend/humanblend.g3db");
    name = "Helper";

    speed = 0.025f;
    climbHeight = 1;

    tool = new ItemStack();
    carryingItemStack = new ItemStack();

    stateMachine = new SyncedStateMachine<Human>(this);
    stateMachine.setInitialState(HelperState.IDLE);

    MessageDispatcher.getInstance().addListener(this, MessageType.STRUCTURE_BROADCAST.ordinal());
}
项目:gdx-ai    文件:PathFinderRequest.java   
/** Creates a {@code PathFinderRequest} with the given arguments. */
public PathFinderRequest (N startNode, N endNode, Heuristic<N> heuristic, GraphPath<N> resultPath, MessageDispatcher dispatcher) {
    this.startNode = startNode;
    this.endNode = endNode;
    this.heuristic = heuristic;
    this.resultPath = resultPath;
    this.dispatcher = dispatcher;

    this.executionFrames = 0;
    this.pathFound = false;
    this.status = SEARCH_NEW;
    this.statusChanged = false;
}
项目:Vloxlands    文件:Human.java   
@Override
public void dispose() {
    super.dispose();
    MessageDispatcher.getInstance().removeListener(this, MessageType.STRUCTURE_BROADCAST.ordinal());
}
项目:Vloxlands    文件:DismantleJob.java   
@Override
public void onEnd() {
    super.onEnd();
    MessageDispatcher.getInstance().dispatchMessage(human, target, MessageType.YOU_ARE_DISMANTLED.ordinal());
}