comment pass

This commit is contained in:
2022-12-29 16:16:49 +01:00
parent 643e03192a
commit ff01a700bd
75 changed files with 634 additions and 65 deletions

View File

@@ -23,6 +23,9 @@ namespace EscapeRoomEngine.Engine.Runtime.Utilities
#region Randomness
/// <summary>
/// Return a random value in a range, including the last value.
/// </summary>
public static int RandomInclusive(int from, int to) => Random.Range(from, to + 1);
#endregion
@@ -41,6 +44,9 @@ namespace EscapeRoomEngine.Engine.Runtime.Utilities
return element;
}
/// <summary>
/// Return a random value from a list.
/// </summary>
public static T RandomElement<T>(this List<T> list) => list[Random.Range(0, list.Count)];
/// <summary>
@@ -59,8 +65,14 @@ namespace EscapeRoomEngine.Engine.Runtime.Utilities
public static class Vector2IntExtensions
{
/// <summary>
/// Project a 2D vector onto the floor in 3D space.
/// </summary>
public static Vector3Int ProjectAtFloor(this Vector2Int vector) => vector.ProjectAtHeight(0);
/// <summary>
/// Project a 2D vector onto a specific height in 3D space.
/// </summary>
public static Vector3Int ProjectAtHeight(this Vector2Int vector, int height) =>
new Vector3Int(vector.x, height, vector.y);
}