Пример #1
0
    public static void TransiteFrom()
    {
        LoadingScreen me = FindObjectOfType <LoadingScreen>();

        if (me != null)
        {
            me.StartCoroutine(me.FadeOut());
            if (me.animation != null)
            {
                me.StopCoroutine(me.animation);
            }
        }
    }
Пример #2
0
    private IEnumerator LoadLevel()
    {
        m_loadingScreen.FadeOut();
        yield return(new WaitUntil(() => !m_loadingScreen.IsFading));

        yield return(null);

        print("level loading started");

        if (m_currentFloor)
        {
            Destroy(m_currentFloor.gameObject);
        }

        m_currentFloor       = Instantiate(m_floorManager);
        m_currentFloor.Floor = m_currentLevel;

        m_TitleScreen.SetActive(false);
        m_readyScreen.SetActive(false);
        m_rulesScreen.SetActive(false);
        m_player.transform.position = m_playerInitPosition;

        m_player.gameObject.SetActive(true);

        switch (m_currentLevel)
        {
        case 1:
            m_player.Initialize(chosenWeapon, chosenProjectile, m_onRestartLevel);
            audioManager.StopAll();
            audioManager.Play("Lvl1");
            break;

        case 2:
            audioManager.StopAll();
            audioManager.Play("Lvl2");
            break;

        case 3:
            audioManager.StopAll();
            audioManager.Play("Lvl3");
            break;

        case 4:
            audioManager.StopAll();
            audioManager.Play("Lvl4");
            break;

        case 5:
            audioManager.StopAll();
            System.Random random    = new System.Random();
            int           select    = random.Next(1, 4);
            string        soundName = "FinalBossLine" + select;
            print("SOUNDNAME: " + soundName);
            audioManager.Play(soundName);      // voiceline
            audioManager.Play("FinalBoss", 3); // music
            break;
        }

        print("m_currentLevel: " + m_currentLevel);

        m_loadingScreen.FadeIn();
        print("level loading done");
    }