Example #1
0
        private IEnumerator OpenNewGameRoutine()
        {
            loadingScreen.FadeIn();
            yield return(new WaitForSeconds(1.0f));

            Debug.Log("Test");
            SceneManager.LoadScene("Game");
        }
Example #2
0
    public static void TransiteTo(string sceneName)
    {
        LoadingScreen me = FindObjectOfType <LoadingScreen>();

        if (me != null)
        {
            me.StartCoroutine(me.FadeIn(sceneName));
            me.animation = me.StartCoroutine(me.ILoadingAnimation());
        }
    }
Example #3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Player")
        {
            PlatformerCharacter2D script = player.GetComponent <PlatformerCharacter2D>();
            if (script == null)
            {
                isGravity = false;
                player.GetComponent <BeamScript>().controls.Disable();
            }
            else
            {
                isGravity = true;
                script.controls.Disable();
                player.GetComponent <RopeSystem>().ResetRope();
                player.GetComponent <RopeSystem>().enabled = false;
            }
            // Freeze Player if hit a spike (tag = lethal_freeze)
            // gameObject.GetComponent<BoxCollider2D>().enabled = false;
            // player.GetComponent<PlatformerCharacter2D>().enabled = false;
            if (gameObject.tag == "Lethal_Freeze")
            {
                cl.isTrigger = false;
                am.SetBool("Dead", true);

                rb.simulated = false;

                // // if (player.transform.rotation.y != 0f)
                // //    faceRight = -1;
                // // else
                // //     faceRight = 1;
                // // hitVelo.x = faceRight * 20f;
                // // rb.velocity = hitVelo;
                // // rb.constraints = RigidbodyConstraints2D.FreezeAll;
                // if (isGravity)
                // {
                //     rb.velocity = hitVelo;
                // }
                player.GetComponent <ParticleSystem>().Play(false);
                player.GetComponent <SpriteRenderer>().enabled = false;
            }

            ls.FadeIn();
            // player.GetComponent<PlatformerCharacter2D>().controls.Disable();
            StartCoroutine(WaitForDeath());
        }
    }
Example #4
0
 // Update is called once per frame
 void Update()
 {
     loadingScreen.FadeIn();
 }
    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");
    }