23 lines
575 B
C#
23 lines
575 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
namespace Assets.Common
|
|
{
|
|
public static class UnityPointExtensions
|
|
{
|
|
public static Vector3 ToVector3(this Point p)
|
|
{
|
|
return new Vector3((float)p.x, 0, (float)p.y);
|
|
}
|
|
}
|
|
|
|
public static class IEnumerableExtensions
|
|
{
|
|
public static T RandomElement<T>(this IEnumerable<T> collection, System.Random generator)
|
|
{
|
|
var count = collection.Count();
|
|
return collection.ElementAt(generator.Next(count));
|
|
}
|
|
}
|
|
} |