void OnLevelWasLoaded() { Debug.Log("loaded"); if (SceneManager.GetActiveScene().name == "Level 1") { dm = GameObject.Find("Dialogue").GetComponent <DialogueManager>(); spySlider = GameObject.Find("SpySlider").GetComponent <Slider>(); loveSlider = GameObject.Find("LoveSlider").GetComponent <Slider>(); player = GameObject.Find("Player"); playerController = player.GetComponent <PlayerController>(); endingCode = "succeedSpy"; rhythmUI = GameObject.Find("RhythmUI").GetComponent <RhythmUI>(); questionMark = GameObject.Find("QuestionMark").GetComponent <QuestionMark>(); romanceMusic = GameObject.Find("RomanceMusic").GetComponent <AudioSource>(); spyMusic = GameObject.Find("SpyMusic").GetComponent <AudioSource>(); DontDestroyOnLoad(GameObject.Find("RomanceMusic")); DontDestroyOnLoad(GameObject.Find("SpyMusic")); audio = GameObject.Find("RhythmUI").GetComponent <AudioSource>(); clucks1 = (AudioClip)Resources.Load("Audio/SFX/clucks1"); clucks2 = (AudioClip)Resources.Load("Audio/SFX/clucks2"); squawk1 = (AudioClip)Resources.Load("Audio/SFX/squawk1"); squawk2 = (AudioClip)Resources.Load("Audio/SFX/squawk2"); thisGM.Start(); } }
// Use this for initialization void Start () { parentUI = transform.parent.gameObject.GetComponent<RhythmUI>(); state = RhythmUI.arrowState.normal; Material newMaterial = new Material(this.gameObject.GetComponent<Image>().material); this.gameObject.GetComponent<Image>().material = newMaterial; }