public void moveTo(int x, int y, int sx, int sy, OnEventOver over) { #if UNITY_EDITOR Debug.Log("GameBattleSceneMovement moveTo0 " + x + " " + y + " " + posX + " " + posY + " " + posXReal + " " + posYReal + " " + moveToXReal + " " + moveToYReal); #endif posXReal = GameCameraManager.instance.PosXReal; posYReal = GameCameraManager.instance.PosYReal - GameBattleManager.instance.LayerHeight; posX = (int)(posXReal / GameDefine.TEXTURE_WIDTH); posY = (int)(-posYReal / GameDefine.TEXTURE_HEIGHT); if ((int)posXReal % GameDefine.TEXTURE_WIDTH > 0) { posX++; } if ((int)-posYReal % GameDefine.TEXTURE_HEIGHT > 0) { posY++; } moveToX = x; moveToY = y; moveToXReal = moveToX * GameDefine.TEXTURE_WIDTH + GameDefine.TEXTURE_WIDTH_HALF; moveToYReal = -moveToY * GameDefine.TEXTURE_HEIGHT - GameDefine.TEXTURE_HEIGHT_HALF; moveToXReal -= GameCameraManager.instance.xOffsetCell; moveToYReal += GameCameraManager.instance.yOffsetCell; posXSpeed = GameDefine.getSpeed(sx) + 20; posYSpeed = GameDefine.getSpeed(sy) + 20; if (posXReal == moveToXReal) { posX = moveToX; } if (posYReal == moveToYReal) { posY = moveToY; } isMoving = true; moveEvent = true; onEventOver = over; #if UNITY_EDITOR Debug.Log("GameBattleSceneMovement moveTo1 " + x + " " + y + " " + posX + " " + posY + " " + posXReal + " " + posYReal + " " + moveToXReal + " " + moveToYReal); #endif }
// public void updatePos() // { // posX = (int)( ( posXReal - GameCameraManager.instance.sceneWidthHlaf ) / GameDefine.TEXTURE_WIDTH ); // posY = (int)( ( posYReal + GameCameraManager.instance.sceneHeightHlaf ) / GameDefine.TEXTURE_HEIGHT ); // // posXReal -= GameCameraManager.instance.sceneWidthHlaf; // posYReal += GameCameraManager.instance.sceneHeightHlaf; // } public void moveToEvent(int x, int y, int sx, int sy, OnEventOver over) { moveToX = x; moveToY = y; moveToXReal = moveToX * GameDefine.TEXTURE_WIDTH; moveToYReal = -moveToY * GameDefine.TEXTURE_HEIGHT; moveToXReal -= (int)GameCameraManager.instance.xOffset; posXSpeed = GameDefine.getSpeed(sx) + 10; posYSpeed = GameDefine.getSpeed(sy) + 10; isMoving = true; onEventOver = over; }