public bool moveToDirection(int x, int y, bool start, bool follow, int speed, OnEventOver over) { if (x == posX && y == posY) { return(false); } if (startMoving) { return(false); } moveSpeed = GameDefine.getMoveSpeed(speed); sceneFollow = follow; playStartAnimation = start; onEventOver = over; moveBuffer.Clear(); moveToX = x; moveToY = y; moveToBattleX = GameDefine.getBattleX(x); moveToBattleY = GameDefine.getBattleY(y); startAnimation(); startMoving = true; return(true); }
public int moveTo(int x, int y, byte cb, bool fly, GameUnitCampType camp, bool start, bool follow, int speed, OnEventOver over) { if (x == posX && y == posY) { return(GameDefine.INVALID_ID); } if (startMoving) { return(GameDefine.INVALID_ID); } moveBuffer.Clear(); int count = GameBattlePathFinder.instance.findPath(posX, posY, x, y, cb, fly, camp); if (count == 0) { return(GameDefine.INVALID_ID); } for (int i = count - 3; i >= 0; i--) { moveBuffer.Add(GameBattlePathFinder.instance.pathResult[i]); } int cost = 0; for (int i = 0; i < moveBuffer.Count / 2; i++) { int xx = moveBuffer[i * 2 + 1]; int yy = moveBuffer[i * 2]; cost += GameBattleUnitMovement.instance.getCellCost(xx, yy); } moveSpeed = GameDefine.getMoveSpeed(speed); sceneFollow = follow; playStartAnimation = start; onEventOver = over; canFollow = GameCameraManager.instance.canFollow(posBattleX, posBattleY, GameBattleManager.instance.LayerHeight); moveNext(); startAnimation(); startMoving = true; return(cost); }
public bool moveToEvent(int x, int y, GameUnitMove unitMove, bool start, bool follow, int speed, OnEventOver over) { if (x == posX && y == posY) { return(false); } if (startMoving) { return(false); } int count = GameBattlePathFinder.instance.findPath(posX, posY, x, y, unitMove.block, unitMove.fly, GameUnitCampType.Count); if (count == 0) { // try fly count = GameBattlePathFinder.instance.findPath(posX, posY, x, y, GameBattlePathFinder.BLOCK_EVENT, true, GameUnitCampType.Count); } if (count == 0) { return(false); } for (int i = count - 3; i >= 0; i--) { moveBuffer.Add(GameBattlePathFinder.instance.pathResult[i]); } moveSpeed = GameDefine.getMoveSpeed(speed); sceneFollow = follow; playStartAnimation = start; onEventOver = over; canFollow = GameCameraManager.instance.canFollow(posBattleX, posBattleY, GameBattleManager.instance.LayerHeight); moveNext(); startAnimation(); startMoving = true; return(true); }
public int moveTo(int x, int y, bool start, bool follow, bool check, int speed, OnEventOver over) { if (x == posX && y == posY) { return(GameDefine.INVALID_ID); } if (startMoving) { return(GameDefine.INVALID_ID); } moveBuffer.Clear(); int count = GameRPGPathFinder.instance.findPath(posX, posY, x, y, check); if (count == 0) { return(GameDefine.INVALID_ID); } for (int i = count - 3; i >= 0; i--) { moveBuffer.Add(GameRPGPathFinder.instance.pathResult[i]); } moveSpeed = GameDefine.getMoveSpeed(speed); sceneFollow = follow; playStartAnimation = start; onEventOver = over; moveNext(); startAnimation(); startMoving = true; return(0); }