/// <summary> /// The Sudoku constructor. /// </summary> /// <param name="basePuzzle">The base puzzle from which to generate the Sudoku puzzle.</param> /// <param name="seed">The seed to use in generating the Sudoku puzzle.</param> public Sudoku(BasePuzzle basePuzzle, int?seed = null) { BasePuzzle = basePuzzle; //If the seed is not specified, generate a new random seed. if (seed == null) { seed = new Random().Next(); } Seed = seed.Value; //Generate Problem and Solution data for the puzzle. ProblemData = GeneratePuzzle(basePuzzle.PuzzleProblemData, Seed); SolutionData = GeneratePuzzle(basePuzzle.PuzzleSolutionData, Seed); }
/// <summary> /// /// </summary> private void Awake() { m_animator = GetComponentInChildren <Animator>(); if (m_animator == null) { Debug.LogError($"Failed to find an animator component on the door '{name}'."); return; } if (Type == DoorType.Puzzle) { m_puzzle = GetComponentInChildren <BasePuzzle>(); if (m_puzzle == null) { Debug.LogError($"Failed to find puzzle on the puzzle door '{name}'."); return; } m_puzzle.gameObject.SetActive(false); } Marker.sharedMaterial = new Material(Marker.sharedMaterial); UnlockDoor(false); }