// Use this for initialization void Start() { hasPlayed = false; boxCol = GetComponent <BoxCollider>(); renderers = GetComponentsInChildren <Renderer>(); audioManager = AudioManagerSingleton.Instance; }
void Awake() { if (AudioManagerSingleton.GetInstance() == null) //Check if an AudioManager has already been assigned to static variable GameManager.instance or if it's still null { Instantiate(AudioManagerObjectPrefab); // Instantiate AudioManager prefab } }
IEnumerator FadeOut() { fader.CrossFadeAlpha(1f, 1f, false); AudioManagerSingleton.GetInstance().SetMusic(MusicType.None); yield return(new WaitForSeconds(1f)); StopAllCoroutines(); Application.LoadLevel("StartScreen"); }
// Use this for initialization void Start() { boxCol = GetComponent <BoxCollider>(); renderers = GetComponentsInChildren <Renderer>(); audioManager = AudioManagerSingleton.Instance; if (GetComponentInChildren <TextMeshProUGUI>() != null) { TextMeshProUGUI textMesh = GetComponentInChildren <TextMeshProUGUI>(); textMesh.text = targetkeyword; } }
IEnumerator ExitStartScreen() { AudioManagerSingleton.GetInstance().SetMusic(MusicType.None); faderImage.gameObject.SetActive(true); faderImage.canvasRenderer.SetAlpha(0f); faderImage.CrossFadeAlpha(1f, 1f, false); yield return(new WaitForSeconds(1.5f)); StopCoroutine(ExitStartScreen()); Application.LoadLevel("ChooseCharacter"); }
void Awake() { if (_instance != null && _instance != this) { Destroy(gameObject); return; } _instance = this; DontDestroyOnLoad(gameObject); if (Options.MusicOn) { _audioSource.Play(); } }
void EnforceSingleton() { if (instance == null) // Check if instance already exists { instance = this; // if not, set instance to this } else if (instance != this) // If instance already exists and it's not this { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); } DontDestroyOnLoad(gameObject); //Sets this to not be destroyed when reloading scene ////Get a component reference to the attached BoardManager script //boardScript = GetComponent<BoardManager>(); ////Call the InitGame function to initialize the first level //InitGame(); }
void Start() { AudioManagerSingleton.GetInstance().SetMusic(musicToSet); }
IEnumerator DisplayStoryText() { yield return(new WaitForSeconds(1f)); audioSource.Play(); textHeader.CrossFadeAlpha(1f, 2f, false); yield return(new WaitForSeconds(2f)); AudioManagerSingleton.GetInstance().SetMusic(MusicType.Game); textBody1.CrossFadeAlpha(1f, fadeDurationSeconds, false); yield return(new WaitForSeconds(3f)); textBody2.CrossFadeAlpha(1f, fadeDurationSeconds, false); yield return(new WaitForSeconds(4f)); textHeader.CrossFadeAlpha(0f, fadeDurationSeconds, false); textBody1.CrossFadeAlpha(0f, fadeDurationSeconds, false); textBody2.CrossFadeAlpha(0f, fadeDurationSeconds, false); yield return(new WaitForSeconds(2f)); textBody1.text = "Your mission is to get Elf back through the maze."; textBody2.text = "Along the way, you'll face doors you can't fit through, characters who won't let you pass, traps set by others, and diminishing health."; textBody1.CrossFadeAlpha(1f, fadeDurationSeconds, false); yield return(new WaitForSeconds(2f)); textBody2.CrossFadeAlpha(1f, fadeDurationSeconds, false); yield return(new WaitForSeconds(5f)); textBody1.CrossFadeAlpha(0f, fadeDurationSeconds, false); textBody2.CrossFadeAlpha(0f, fadeDurationSeconds, false); yield return(new WaitForSeconds(2f)); textBody1.text = "You'll have the help of other characters that you befriend throughout the game."; textBody2.text = "But take caution...Some might be a friendly face hiding evil, and others might be a friend wearing an evil face."; textBody1.CrossFadeAlpha(1f, fadeDurationSeconds, false); yield return(new WaitForSeconds(3f)); textBody2.CrossFadeAlpha(1f, fadeDurationSeconds, false); yield return(new WaitForSeconds(4f)); textBody1.CrossFadeAlpha(0f, fadeDurationSeconds, false); textBody2.CrossFadeAlpha(0f, fadeDurationSeconds, false); yield return(new WaitForSeconds(2f)); textBody1.text = "Elf needs you to see past stereotypes and think critically to get back into place."; textBody2.text = "The fate of Elf, and all the characters of the book, rests with you."; textBody1.CrossFadeAlpha(1f, fadeDurationSeconds, false); yield return(new WaitForSeconds(3f)); textBody2.CrossFadeAlpha(1f, fadeDurationSeconds, false); yield return(new WaitForSeconds(4f)); textFooter.CrossFadeAlpha(1f, fadeDurationSeconds, false); yield return(new WaitForSeconds(2f)); textBody1.CrossFadeAlpha(0f, fadeDurationSeconds, false); textBody2.CrossFadeAlpha(0f, fadeDurationSeconds, false); yield return(new WaitForSeconds(2f)); textFooter.CrossFadeAlpha(0f, 2f, false); skipButton.CrossFadeAlpha(0f, 2f, false); yield return(new WaitForSeconds(3f)); StopCoroutine(DisplayStoryText()); StopCoroutine(SkipIntro()); LoadNextScene(); }
public void OnChangeVolume(Slider inSlider) { AudioManagerSingleton.GetInstance().SetGlobalVolume(inSlider.value); }
void OnEnable() { Debug.Log("on enable! " + name); GetComponent <AudioSource>().volume = AudioManagerSingleton.GetInstance().GetGlobalVolume(); }