public override void onMessage(Movable obj, StateMsg <Movable> msg) { MovableMsg type = (MovableMsg)msg.type; switch (type) { case MovableMsg.breakKinematic: obj.getSM().changeState(NormalState.Instance()); break; case MovableMsg.moveLeft: obj.doMoveLeft(); break; case MovableMsg.moveRight: obj.doMoveRight(); break; case MovableMsg.moveUp: obj.doMoveUp(); break; case MovableMsg.stopMove: obj.doStopMove(); break; case MovableMsg.wait: obj.doWait(); break; } }
public override void onMessage(Movable obj, StateMsg <Movable> msg) { MovableMsg type = (MovableMsg)msg.type; switch (type) { case MovableMsg.onLabber: obj.getSM().changeState(OnLabberState.Instance()); break; case MovableMsg.toNormal: obj.getSM().changeState(NormalState.Instance()); break; case MovableMsg.moveDown: //降落 if (!obj.downTileIsBlock()) { obj.setFallTargetY(true); obj.getSM().changeState(FallToTargetState.Instance()); } break; case MovableMsg.moveLeft: obj.doMoveLeft(); obj.adjustWhenMoveOnRope(); break; case MovableMsg.moveRight: obj.doMoveRight(); obj.adjustWhenMoveOnRope(); break; case MovableMsg.stopMove: obj.doStopMove(); break; case MovableMsg.wait: obj.doWait(); break; case MovableMsg.moveUp: //通知發訊者此動作無效 if (msg.sender != null) { //從繩子移到JumpPoint會發動fall to rope,這時目標就停留在JumpPoint // //--J // -- if (Movable.Debug_do_moveUp) { obj.printDebugMsg("[注意!]do MoveUp on rope"); } AIMoveController ai = msg.sender.myAI; ai.getSM().handleMessage(new StateMsg <AIMoveController>((int)AIMsg.reFindPath, null)); } break; } }
public override void onMessage(Movable obj, StateMsg <Movable> msg) { MovableMsg type = (MovableMsg)msg.type; switch (type) { case MovableMsg.onRope: obj.getSM().changeState(OnRopeState.Instance()); break; case MovableMsg.onLabber: obj.getSM().changeState(OnLabberState.Instance()); break; case MovableMsg.landing: obj.getSM().changeState(NormalState.Instance()); break; case MovableMsg.toKinematic: obj.getSM().changeState(KinematicState.Instance()); break; } }