Example #1
0
 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
     }
 }
Example #2
0
    IEnumerator FadeOut()
    {
        fader.CrossFadeAlpha(1f, 1f, false);
        AudioManagerSingleton.GetInstance().SetMusic(MusicType.None);

        yield return(new WaitForSeconds(1f));

        StopAllCoroutines();
        Application.LoadLevel("StartScreen");
    }
Example #3
0
    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");
    }
Example #4
0
 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();
    }
Example #6
0
 public void OnChangeVolume(Slider inSlider)
 {
     AudioManagerSingleton.GetInstance().SetGlobalVolume(inSlider.value);
 }
Example #7
0
 void OnEnable()
 {
     Debug.Log("on enable! " + name);
     GetComponent <AudioSource>().volume = AudioManagerSingleton.GetInstance().GetGlobalVolume();
 }