public void PuzzleCompleted(Puzzle puzzle)
{
if (isGameOver)
{
Debug.Log("GAME OVER!!! Let the player know!!");
return;
}
var growthIncrement = puzzle.puzzleWeight / weightedIncrementTotal;
growthIncrement *= 2;
// Notify room of growth increment
wallMgr.Resize(wallMgr.transformRoom + growthIncrement);
KickOffSoundForPuzzle(puzzle);
if (puzzle.IsResetable() && puzzles.Contains(puzzle))
{
Debug.Log("Puzzle marked for reset");
puzzle.MarkForReset();
}
AdjustHighlightColor(puzzle);
// Remove the puzzle, but also allow it to remain in the list multiple times
puzzles.Remove(puzzle);
Debug.Log("Finished puzzle: " + puzzle + ", " + puzzles.Count + " left, room growing to: " + (wallMgr.transformRoom + growthIncrement));
if (puzzles.Count == 1)
{
Debug.Log("Final puzzle: " + puzzles[0]);
}
else if (puzzles.Count == 0)
{
isGameOver = true;
}
if (isGameOver)
{
StopAllCoroutines(); // Turn off sounds
if (puzzleWinSound)
{
puzzleWinSound.Stop();
}
isGameOver = true;
uiManager.SetInstructionsForTime("Well done, you've brought order to chaos!", 15f);
AudioSource finalSource = GetComponentInParent <AudioSource>();
if (finalSource)
{
finalSource.Play();
}
}
}