Пример #1
0
 /// <summary>
 /// Gets a collection of direction vectors pointing in the
 /// given directions relative to the given coordainte.
 /// </summary>
 public static IEnumerable <Vector2Int> GetRelativeDirections(this Vector2Int coordinate, Vector2Int from, RelativeDirection direction)
 {
     if (direction.HasFlag(RelativeDirection.Away))
     {
         yield return(coordinate.Away(from));
     }
     if (direction.HasFlag(RelativeDirection.Towards))
     {
         yield return(coordinate.Towards(from));
     }
     if (direction.HasFlag(RelativeDirection.Left))
     {
         yield return(coordinate.Left(from));
     }
     if (direction.HasFlag(RelativeDirection.Right))
     {
         yield return(coordinate.Right(from));
     }
 }