public static void Main() { System.Console.WriteLine("Creating random board."); PuzzleBoard board = new PuzzleBoard(5, 5); PuzzleBoardController boardController = new PuzzleBoardController(board); boardController.FillBoardWithNewOrbs(); System.Console.WriteLine(boardController.GetBoardString()); System.Console.WriteLine("Checking matches"); boardController.CheckForMatches(); boardController.CheckForCombos(); System.Console.WriteLine(boardController.GetCombosString()); if (boardController.ComboCount > 0) { System.Console.WriteLine("Moving matched orbs to the top"); boardController.MoveMatchedOrbsToTheTop(); System.Console.WriteLine(boardController.GetBoardString()); System.Console.WriteLine("Assign new color to matched orbs"); boardController.AssignNewColorToMatchedOrbs(); boardController.ClearMatches(); System.Console.WriteLine(boardController.GetBoardString()); } }
private void GetAllComponents() { PuzzleBoardController = GetComponentInChildren<PuzzleBoardController>() as PuzzleBoardController; if (PuzzleBoardController == null) { throw new UnityException("PuzzleGameController must have a PuzzleBoardController component as a child."); } PuzzlePresentationController = GetComponentInChildren<PuzzlePresentationController>() as PuzzlePresentationController; if (PuzzlePresentationController == null) { throw new UnityException("PuzzleGameController must have a PuzzlePresentationController component as a child."); } GemSwapper = GetComponentInChildren<GemSwapper>() as GemSwapper; if (GemSwapper == null) { throw new UnityException("PuzzleGameController must have a GemSwapper component as a child."); } }
private void GetAllComponents() { PuzzleBoardController = GetComponentInChildren <PuzzleBoardController>() as PuzzleBoardController; if (PuzzleBoardController == null) { throw new UnityException("PuzzleGameController must have a PuzzleBoardController component as a child."); } PuzzlePresentationController = GetComponentInChildren <PuzzlePresentationController>() as PuzzlePresentationController; if (PuzzlePresentationController == null) { throw new UnityException("PuzzleGameController must have a PuzzlePresentationController component as a child."); } GemSwapper = GetComponentInChildren <GemSwapper>() as GemSwapper; if (GemSwapper == null) { throw new UnityException("PuzzleGameController must have a GemSwapper component as a child."); } }