mirror of
https://github.com/MaddyThorson/StrawberryBF.git
synced 2026-10-19 13:59:23 +08:00
Some Calc comments. Cardinals enum
This commit is contained in:
1 parent
95c2d5f12f
commit
17fc10eb7c
2 files changed
+77
No files matched your search
@@ -0,0 +1,70 @@
|
||||
namespace Strawberry
|
||||
{
|
||||
public enum Cardinals
|
||||
{
|
||||
case Right;
|
||||
case Down;
|
||||
case Left;
|
||||
case Up;
|
||||
|
||||
public Cardinals Opposite()
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
case .Right:
|
||||
return .Left;
|
||||
case .Left:
|
||||
return .Right;
|
||||
case .Up:
|
||||
return .Down;
|
||||
case .Down:
|
||||
return .Up;
|
||||
}
|
||||
}
|
||||
|
||||
public Cardinals NextClockwise()
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
case .Right:
|
||||
return .Down;
|
||||
case .Left:
|
||||
return .Up;
|
||||
case .Up:
|
||||
return .Right;
|
||||
case .Down:
|
||||
return .Left;
|
||||
}
|
||||
}
|
||||
|
||||
public Cardinals NextCounterClockwise()
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
case .Right:
|
||||
return .Up;
|
||||
case .Left:
|
||||
return .Down;
|
||||
case .Up:
|
||||
return .Left;
|
||||
case .Down:
|
||||
return .Right;
|
||||
}
|
||||
}
|
||||
|
||||
static public implicit operator Point(Cardinals c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case .Right:
|
||||
return Point.Right;
|
||||
case .Left:
|
||||
return Point.Left;
|
||||
case .Up:
|
||||
return Point.Up;
|
||||
case .Down:
|
||||
return Point.Down;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user