Ejemplo n.º 1
0
    IEnumerator OnTriggerEnter2D(Collider2D other)
    {
        //stops player movement
        PlayerMovement moveScript = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement> ();

        moveScript.canMove = false;
        rbody.constraints  = RigidbodyConstraints2D.FreezePosition;

        //causes screen fade
        ScreenFader sf = GameObject.FindGameObjectWithTag("Fader").GetComponent <ScreenFader> ();

        yield return(StartCoroutine(sf.FadetoBlack()));

        MusicSource.Play();

        //moves player and camera position to warp target
        other.gameObject.transform.position = warpTarget.position;
        Camera.main.transform.position      = warpTarget.position;

        yield return(StartCoroutine(sf.FadetoClear()));

        //player can move again
        moveScript.canMove = true;
        rbody.constraints  = RigidbodyConstraints2D.None;
        rbody.constraints  = RigidbodyConstraints2D.FreezeRotation;
    }
Ejemplo n.º 2
0
    IEnumerator EndDialogue()
    {
        DialogueBox.SetActive(false);

        ScreenFader sf = GameObject.FindGameObjectWithTag("Fader").GetComponent <ScreenFader> ();

        yield return(StartCoroutine(sf.FadetoBlack()));

        SceneManager.LoadScene(sceneIndex);

        yield return(StartCoroutine(sf.FadetoClear()));
    }
Ejemplo n.º 3
0
    IEnumerator GoToClass()
    {
        PlayerMovement moveScript = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement> ();

        moveScript.canMove = false;
        rbody.constraints  = RigidbodyConstraints2D.FreezePosition;

        MusicSource.Play();

        ScreenFader sf = GameObject.FindGameObjectWithTag("Fader").GetComponent <ScreenFader> ();

        yield return(StartCoroutine(sf.FadetoBlack()));

        SceneManager.LoadScene(sceneIndex);

        yield return(StartCoroutine(sf.FadetoClear()));

        moveScript.canMove = true;
        rbody.constraints  = RigidbodyConstraints2D.None;
        rbody.constraints  = RigidbodyConstraints2D.FreezeRotation;
    }