mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-12-24 17:29:23 +01:00
added angle method to direction
This commit is contained in:
parent
73f9653ddc
commit
7dbc5dd608
1 changed files with 23 additions and 0 deletions
|
@ -87,5 +87,28 @@ namespace MLEM.Misc {
|
|||
}
|
||||
}
|
||||
|
||||
public static float Angle(this Direction2 dir) {
|
||||
switch (dir) {
|
||||
case Direction2.Up:
|
||||
return MathHelper.PiOver2;
|
||||
case Direction2.Right:
|
||||
return MathHelper.TwoPi;
|
||||
case Direction2.Down:
|
||||
return 3 * MathHelper.PiOver2;
|
||||
case Direction2.Left:
|
||||
return MathHelper.Pi;
|
||||
case Direction2.UpRight:
|
||||
return MathHelper.PiOver4;
|
||||
case Direction2.DownRight:
|
||||
return 7 * MathHelper.PiOver4;
|
||||
case Direction2.DownLeft:
|
||||
return 5 * MathHelper.PiOver4;
|
||||
case Direction2.UpLeft:
|
||||
return 3 * MathHelper.PiOver4;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue