Example #1
0
    // Use this for initialization
    void Awake()
    {
        loader = this.GetComponent <Loader>();
        loader.AddEventListener(this.gameObject);
        loader.LoadScene(sceneToLoad);

        sadMax   = this.transform.Find("Sprites/headlogoSad").GetComponent <SpriteRenderer>();
        happyMax = this.transform.Find("Sprites/headlogoHappy").GetComponent <SpriteRenderer>();

        if (isLoadedFromIntroScene)
        {
            backgroundMusic = GameObject.Find("BackgroundMusic").GetComponent <SoundObject>();
            DontDestroyOnLoad(backgroundMusic);
        }

        if (sceneToLoad == Scene.EndScene)
        {
            backgroundMusic = GameObject.Find("BackgroundMusic").GetComponent <SoundObject>();
            if (backgroundMusic)
            {
                backgroundMusic.Mute();
            }
        }

        if (sceneToLoad == Scene.FinalMainScene ||
            sceneToLoad == Scene.EndScene || sceneToLoad == Scene.AlternativeEndScene)
        {
            sadMax.enabled   = true;
            happyMax.enabled = false;
        }
    }