TECH TREES WHOO
Implemented procedural tech tree generation by porting GraphSharp to Unity. Also, some database editor convenience changes.
This commit is contained in:
parent
7cd24147ae
commit
d5f2e3734a
573 changed files with 31001 additions and 222 deletions
|
|
@ -9,6 +9,7 @@ using MessagePack;
|
|||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
using Random = Unity.Mathematics.Random;
|
||||
using Unity.Tiny;
|
||||
|
||||
public static class Extensions
|
||||
{
|
||||
|
|
@ -67,7 +68,7 @@ public static class Extensions
|
|||
|
||||
private static Random? _random;
|
||||
private static Random Random => (Random) (_random ?? (_random = new Random(1337)));
|
||||
public static T RandomElement<T>(this IEnumerable<T> enumerable) => enumerable.ElementAt(Random.NextInt(0, enumerable.Count()));
|
||||
//public static T RandomElement<T>(this IEnumerable<T> enumerable) => enumerable.ElementAt(Random.NextInt(0, enumerable.Count()));
|
||||
public static float NextUnbounded(this Random random) => 1 / (1 - random.NextFloat()) - 1;
|
||||
public static float NextUnbounded(this Random random, float bias, float power) => 1 / (1 - pow(random.NextFloat(), 1 - pow(clamp(bias,0,.99f), 1 / power))) - 1;
|
||||
|
||||
|
|
@ -284,6 +285,12 @@ public static class ObjectExtensions
|
|||
{
|
||||
return (T)Copy((Object)original);
|
||||
}
|
||||
|
||||
public static bool IntersectsWith(this Rect r1, Rect r2)
|
||||
{
|
||||
return (r2.x + r2.width >= r1.x && r2.x <= r1.x + r1.width) &&
|
||||
(r2.y + r2.height >= r1.y && r2.y <= r1.y + r1.height);
|
||||
}
|
||||
}
|
||||
|
||||
public class ReferenceEqualityComparer : EqualityComparer<Object>
|
||||
|
|
|
|||
Loading…
Reference in a new issue