2018-03-30 20:46:24 +08:00
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
|
|
namespace StardustCore.Enums
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>A custom class used to wrap Stardew Valley's direction conventions.</summary>
|
2018-03-30 20:46:24 +08:00
|
|
|
public class Directions
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>An enum used to wrap directions.</summary>
|
2018-03-30 20:46:24 +08:00
|
|
|
public enum Direction
|
|
|
|
{
|
|
|
|
[Description("Up")]
|
|
|
|
up,
|
2018-12-30 18:00:05 +08:00
|
|
|
|
2018-03-30 20:46:24 +08:00
|
|
|
[Description("Right")]
|
|
|
|
right,
|
2018-12-30 18:00:05 +08:00
|
|
|
|
2018-03-30 20:46:24 +08:00
|
|
|
[Description("Down")]
|
|
|
|
down,
|
2018-12-30 18:00:05 +08:00
|
|
|
|
2018-03-30 20:46:24 +08:00
|
|
|
[Description("Left")]
|
|
|
|
left
|
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Get the up direction.</summary>
|
2018-03-30 20:46:24 +08:00
|
|
|
public static Direction GetUp()
|
|
|
|
{
|
|
|
|
return Direction.up;
|
|
|
|
}
|
2018-12-30 18:00:05 +08:00
|
|
|
|
|
|
|
/// <summary>Get the down direction.</summary>
|
2018-03-30 20:46:24 +08:00
|
|
|
public static Direction GetDown()
|
|
|
|
{
|
|
|
|
return Direction.down;
|
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Get the left direction.</summary>
|
2018-03-30 20:46:24 +08:00
|
|
|
public static Direction GetLeft()
|
|
|
|
{
|
|
|
|
return Direction.left;
|
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Get the right dirction.</summary>
|
2018-03-30 20:46:24 +08:00
|
|
|
public static Direction GetRight()
|
|
|
|
{
|
|
|
|
return Direction.right;
|
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Converts a direction into it's stardew valley direction equivelent.</summary>
|
2018-05-01 09:21:31 +08:00
|
|
|
/// <param name="dir"></param>
|
2018-03-30 20:46:24 +08:00
|
|
|
public static int DirectionToInt(Direction dir)
|
|
|
|
{
|
|
|
|
return (int)dir;
|
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Get's the direction's enum description so we can convert this to a string.</summary>
|
2018-03-30 20:46:24 +08:00
|
|
|
public static string getString(Direction dir)
|
|
|
|
{
|
|
|
|
return dir.GetEnumDescription();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|