This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
/// <summary> Customizes the field shown in inspector and clamps the values as <see cref="RangeAttribute"/> does </summary> | |
public sealed partial class VectorRangeAttribute : PropertyAttribute | |
{ | |
public readonly (float minX, float maxX, float minY, float maxY, float minZ, float maxZ, float minW, float maxW) clamped; | |
public VectorRangeAttribute | |
( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
public static class IEnumeratorExtensions | |
{ | |
/// <summary> Allows you to iterate through an IEnumerator </summary> | |
public static T GetEnumerator<T>(this T enumerator)t | |
where T : IEnumerator | |
{ | |
return enumerator; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public static class RandomExtensions | |
{ | |
public static float NextFloat(this Random random, float minInclusiveValue, float maxExclusiveValue) | |
=> (float)random.NextDouble(minInclusiveValue, maxExclusiveValue); | |
public static double NextDouble(this Random random, double minInclusiveValue, double maxExclusiveValue) | |
{ | |
return random.NextDouble() * (maxExclusiveValue - minInclusiveValue) + minInclusiveValue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public static class EnumExtensions | |
{ | |
/// <summary> Checks if enum 'a' contains any of the value(s) from 'b' </summary> | |
public static bool HasAny<EnumType>(this EnumType a, EnumType b) | |
where EnumType : Enum | |
{ | |
// Check for the supported enum types | |
return a.GetTypeCode() switch |