Ejemplo n.º 1
0
    public void OnTriggerEnter2D(Collider2D other)
    {
        if (PlayerPrefs.GetInt(Constants.Prefs.CHANGING_FLOOR, Constants.Prefs.Defaults.CHANGING_FLOOR) == 1)
        {
            return;
        }

        if (other.tag == "DownstairsTransition")
        {
            StartCoroutine(mplayer.PlayLoopedFootsteps());
            PlayerPrefs.SetInt(Constants.Prefs.CHANGING_FLOOR, 1);
            StartCoroutine(screenFader.FadeToScene(Constants.Levels.LEVEL_0));
        }
        else if (other.tag == "UpstairsTransition")
        {
            StartCoroutine(mplayer.PlayLoopedFootsteps());
            PlayerPrefs.SetInt(Constants.Prefs.CHANGING_FLOOR, 1);
            StartCoroutine(screenFader.FadeToScene(Constants.Levels.LEVEL_1));
        }
    }