public override Maze GetMaze() { if (mazeGenerator == null) { throw new System.InvalidOperationException("No maze generator assigned."); } var random = new System.Random(seed); var enabledMotions = new List <RigidMotion>(8); if (Identity) { enabledMotions.Add(new RigidMotion()); } if (ClockwiseNinety) { enabledMotions.Add(new RigidMotion(1, false)); } if (ClockwiseOneEighty) { enabledMotions.Add(new RigidMotion(2, false)); } if (ClockwiseTwoSeventy) { enabledMotions.Add(new RigidMotion(3, false)); } if (FlipAcrossBottomLeftToTopRight) { enabledMotions.Add(new RigidMotion(0, true)); } if (FlipAcrossTopLeftToBottomRight) { enabledMotions.Add(new RigidMotion(2, true)); } if (FlipAcrossHorizontal) { enabledMotions.Add(new RigidMotion(3, true)); } if (FlipAcrossVertical) { enabledMotions.Add(new RigidMotion(1, true)); } if (enabledMotions.Count == 0) { throw new System.InvalidOperationException("Must enable at least one symmetry."); } RigidMotion chosenMotion = enabledMotions[random.Next(0, enabledMotions.Count)]; return(chosenMotion.Apply(mazeGenerator.GetMaze())); }
void Start() { move = GetComponent<RigidMotion>(); }