public static Direction WhichWayIs(Coords from, Backend.Coords to, bool DirectOnly = false)
{
if (from.x < to.x)
{
if (from.y < to.y)
{
if (!DirectOnly)
return Direction.UpLeft;
else
return Direction.Up;
}
else
{
if (from.y > to.y)
{
if (!DirectOnly)
return Direction.DownLeft;
else
return Direction.Left;
}
else
{
return Direction.Left;
}
}
}
else
{
if (from.x > to.x)
{
if (from.y < to.y)
{
if (!DirectOnly)
return Direction.UpRight;
else
return Direction.Up;
}
else
{
if (from.y > to.y)
{
if (!DirectOnly)
return Direction.DownRight;
else
return Direction.Right;
}
else
{
return Direction.Right;
}
}
}
else
{
if (from.y < to.y)
{
return Direction.Up;
}
else
{
if (from.y > to.y)
{
return Direction.Down;
}
}
}
}
return Direction.None;
}