split into multiple assemblies

This commit is contained in:
2022-11-20 12:52:22 +01:00
parent def03954a0
commit 9fdfafc3eb
373 changed files with 380 additions and 119 deletions

View File

@@ -0,0 +1,32 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace EscapeRoomEngine.Engine.Runtime.Utilities
{
public static class Utilities
{
#region Math
/// <summary>
/// Returns whether a position relative to some dimensions is inside those dimensions.
/// </summary>
/// <param name="position">The position to check, relative to the dimensions.</param>
/// <param name="dimensions">The dimensions to check the position against.</param>
public static bool IsInsideRelative(this Vector2Int position, Dimensions dimensions)
{
return position.x >= 0 && position.y >= 0 && position.x < dimensions.width && position.y < dimensions.length;
}
#endregion
#region Randomness
public static int RandomInclusive(int from, int to) => Random.Range(from, to + 1);
public static T RandomElement<T>(this List<T> list) => list[Random.Range(0, list.Count)];
public static T RandomElement<T>(this HashSet<T> set) => set.ElementAt(Random.Range(0, set.Count));
#endregion
}
}