using System.Collections.Generic; namespace EscapeRoomEngine.Engine.Runtime { public enum Orientation { North = 0, East = 90, South = 180, West = 270 } public static class OrientationExtensions { public static HashSet EveryOrientation() => new(new[] { Orientation.North, Orientation.East, Orientation.South, Orientation.West }); /// /// Return the orientation corresponding to an angle, starting at 0 degrees North and going clockwise around the compass. /// public static Orientation FromAngle(int angle) => (Orientation)angle; /// /// Turn an orientation into its corresponding angle. /// public static float Angle(this Orientation orientation) => (float)orientation; /// /// Turn an orientation into its corresponding angle. /// public static int AngleInt(this Orientation orientation) => (int)orientation; /// /// Rotate an orientation by a specific amount of quarter rotations. Rotating East thrice would return North. /// public static Orientation Rotated(this Orientation orientation, int quarterRotations) => orientation + quarterRotations * 90; } }