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(this IEnumerable collection, System.Random generator) { var count = collection.Count(); return collection.ElementAt(generator.Next(count)); } public static IEnumerable RotateRight(this IEnumerable collection, int count = 1) { var diff = collection.Count() - count; var head = collection.Take(diff); var tail = collection.Skip(diff).Take(count); return tail.Concat(head); } } }