Created
November 5, 2019 01:33
-
-
Save xepherys/c4c47a83c18315591c97392f91fb28ff to your computer and use it in GitHub Desktop.
BitFlag Enum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Flags] | |
public enum LaserDirection | |
{ | |
NONE = 0, | |
NORTH = 1 << 0, | |
NORTHEAST = 1 << 1, | |
EAST = 1 << 2, | |
SOUTHEAST = 1 << 3, | |
SOUTH = 1 << 4, | |
SOUTHWEST = 1 << 5, | |
WEST = 1 << 6, | |
NORTHWEST = 1 << 7, | |
OMNI = ~(~0 << 8) | |
} | |
// [System.Flags] sets the enum as a bitflag type | |
// NONE = 0 gives the option to have no values set | |
// each additional value takes 1 << x as the bitshifted value | |
// the final value is an "ALL" value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment