|
|
- //Use this file to Global enums in
-
- public enum Direction { Left, Right,Forward, Back}
-
- public static class DirectionExtras
- {
- public static Direction Random()
- {
- int r = UnityEngine.Random.Range(0, 4);
- switch (r)
- {
- case 0:
- return Direction.Forward;
- case 1:
- return Direction.Right;
- case 2:
- return Direction.Left;
- case 3:
- return Direction.Back;
- }
- return Direction.Forward;
- }
-
- public static Direction[] RandomOrder()
- {
-
- System.Collections.Generic.List<Direction> selection = new System.Collections.Generic.List<Direction>(new Direction[] { Direction.Right,Direction.Left,Direction.Forward,Direction.Back});
- Direction[] retVal = new Direction[4];
-
- for (int i = 0; i < 4; i++)
- {
- int r = UnityEngine.Random.Range(0, selection.Count);
- retVal[i] = selection[r];
- selection.RemoveAt(r);
- }
-
- return retVal;
- }
- }
|