forked from Syomus/ProceduralToolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Directions.cs
41 lines (37 loc) · 958 Bytes
/
Directions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
namespace ProceduralToolkit
{
/// <summary>
/// Specifies directions along thee axes
/// </summary>
[Flags]
public enum Directions
{
None = 0,
Left = 1,
Right = 2,
Down = 4,
Up = 8,
Back = 16,
Forward = 32,
XAxis = Left | Right,
YAxis = Down | Up,
ZAxis = Back | Forward,
All = Left | Right | Down | Up | Back | Forward
}
public static class DirectionsExtensions
{
public static bool HasFlag(this Directions directions, Directions flag)
{
return (directions & flag) == flag;
}
public static Directions AddFlag(this Directions directions, Directions flag)
{
return directions | flag;
}
public static Directions RemoveFlag(this Directions directions, Directions flag)
{
return directions & ~flag;
}
}
}