예제 #1
0
    private void CompletePuzzle()
    {
        //Plays correct sound
        //correctSound.Play();

        //Stops any currently playing sounds and queues some notes to play a tune
        synthesiser.ClearNotes();
        synthesiser.AddTimedNote(60, 0.5f);
        synthesiser.AddTimedNote(57, 0.5f);
        synthesiser.AddTimedNote(67, 0.5f);
        synthesiser.AddTimedNote(64, 0.5f);
        synthesiser.AddTimedNote(62, 0.5f);
        puzzleComplete = true;

        //Enables scripts on attached game objects so they activate
        //Door opens and lift starts moving
        for (int i = 0; i < puzzleObjects.Count; i++)
        {
            if (puzzleObjects[i] != null)
            {
                foreach (MonoBehaviour mono in puzzleObjects[i].GetComponents <MonoBehaviour>())
                {
                    if (mono.isActiveAndEnabled)
                    {
                        mono.enabled = false;
                    }
                    else
                    {
                        mono.enabled = true;
                    }
                }
            }
        }
    }