public static Hex RotateHex(Hex hex, int direction) { Vector3 cube = HexCalcs.hex_to_cube(hex); for (; direction > 0; direction--) { float temp = cube.x; cube.x = -cube.z; cube.z = -cube.y; cube.y = -temp; } for (; direction < 0; direction++) { float temp = cube.x; cube.x = -cube.y; cube.y = -cube.z; cube.z = -temp; } return(HexCalcs.cube_to_hex(cube)); }
//positive increments of 60 degrees clockwise public void Rotate(int amount) { hex = HexCalcs.RotateHex(hex, -amount); }