namespace Holo.Virtual.Rooms.Pathfinding { using System; public static class Rotation { public static byte Calculate(int X1, int Y1, int X2, int Y2) { byte num = 0; if ((X1 > X2) && (Y1 > Y2)) { return 7; } if ((X1 < X2) && (Y1 < Y2)) { return 3; } if ((X1 > X2) && (Y1 < Y2)) { return 5; } if ((X1 < X2) && (Y1 > Y2)) { return 1; } if (X1 > X2) { return 6; } if (X1 < X2) { return 2; } if (Y1 < Y2) { return 4; } if (Y1 > Y2) { num = 0; } return num; } public static byte headRotation(byte headRot, int X, int Y, int toX, int toY) { if (headRot == 2) { if ((X > toX) || (Y >= toY)) { if ((X <= toX) && (Y > toY)) { return 1; } if ((X >= toX) || (Y != toY)) { return headRot; } } return 2; } if (headRot == 4) { if ((X > toX) && (Y <= toY)) { return 5; } if ((X < toX) && (Y <= toY)) { return 3; } if ((X != toX) || (Y >= toY)) { return headRot; } return 4; } if (headRot == 6) { if ((X >= toX) && (Y > toY)) { return 7; } if ((X >= toX) && (Y < toY)) { return 5; } if ((X <= toX) || (Y != toY)) { return headRot; } return 6; } if (headRot == 0) { if ((X > toX) && (Y >= toY)) { return 9; } if ((X < toX) && (Y >= toY)) { return 1; } if ((X == toX) && (Y > toY)) { return 0; } } return headRot; } public static byte headRotation2(int oldx, int oldy, int newx, int newy) { if (oldx == newx) { if (oldy < newy) { return 4; } return 0; } if (oldx > newx) { if (oldy == newy) { return 6; } if (oldy < newy) { return 5; } return 7; } if (oldx >= newx) { return 0; } if (oldy == newy) { return 2; } if (oldy < newy) { return 3; } return 1; } } }