private void Update() { if (isDetected && !player.IsFan) { SoundManager.instance.PlaySingle(aAlarm); alarm.isAlarm = true; if (discretion < maxDiscretion) { discretion += 0.1f; } else { SoundManager.instance.PlaySingle(aDead); fader.insertText("GAME OVER. RESTARTING..."); fader.FadeIn(); isDetected = false; StartCoroutine(restart()); } } if (!isDetected) { if (0 < discretion) { discretion -= 0.1f; } } progressbar.GetComponent <Image>().fillAmount = discretion / 20; }
void ChangeScene() { Application.LoadLevel(targetScene); targetScene = ""; changingScene = false; sceneFader.FadeIn(); }