26 lines
819 B
C#
26 lines
819 B
C#
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<Orientation> EveryOrientation() => new(new[]
|
|
{
|
|
Orientation.North, Orientation.East, Orientation.South, Orientation.West
|
|
});
|
|
|
|
public static Orientation FromAngle(int angle) => (Orientation)angle;
|
|
|
|
public static float Angle(this Orientation orientation) => (float)orientation;
|
|
|
|
public static int AngleInt(this Orientation orientation) => (int)orientation;
|
|
|
|
public static Orientation Rotated(this Orientation orientation, int quarterRotations) =>
|
|
orientation + quarterRotations * 90;
|
|
}
|
|
} |