| | | 1 | | using System.Collections; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using UnityEngine; |
| | | 4 | | |
| | | 5 | | public class FindEscape : MonoBehaviour { |
| | | 6 | | // Play audio sequence and show congratulatory messsage for escaping room |
| | 1 | 7 | | public void Escape() { |
| | 1 | 8 | | DigitalClock clock = GameObject.FindGameObjectWithTag ("digitalLED").GetComponent<DigitalClock>(); |
| | 1 | 9 | | AudioSource breakEffect = GameObject.FindWithTag("mirror").GetComponent<AudioSource>(); |
| | 1 | 10 | | breakEffect.Play(); |
| | 1 | 11 | | GameObject.Destroy(GameObject.FindGameObjectWithTag ("reflectionProbe")); |
| | 1 | 12 | | string form = (clock.score == 1) ? "minute" : "minutes"; |
| | 1 | 13 | | gameObject.GetComponent<Usable>().Inspect( |
| | | 14 | | string.Format("You've successfully escaped in {0} {1}!", clock.score, form) |
| | | 15 | | ); |
| | 1 | 16 | | GameObject.FindWithTag("mirror").GetComponent<Usable>().enabled = false; |
| | 1 | 17 | | GameObject.FindWithTag("mirror").GetComponent<Collectable>().enabled = false; |
| | 1 | 18 | | GameObject.FindWithTag("mirror").GetComponent<Collider>().enabled = false; |
| | 1 | 19 | | AudioSource bgAudio = GameObject.Find("Background Music").GetComponent<AudioSource>(); |
| | 1 | 20 | | bgAudio.Stop(); |
| | 1 | 21 | | StopCoroutine("PlayTime"); |
| | 2 | 22 | | if (clock.pointFlicker && clock.secondsDCV == null) { |
| | 1 | 23 | | StopCoroutine("PlayPointFlicker"); |
| | 1 | 24 | | } |
| | 1 | 25 | | } |
| | | 26 | | } |