Exemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.name == "Player")
     {
         level.RespawnPlayer();
     }
 }
Exemplo n.º 2
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.name == "Player")
     {
         level.RespawnPlayer();
     }
     jugador.GetComponent <Rigidbody2D>().velocity = new Vector2(0, jugador.GetComponent <Rigidbody2D>().velocity.y);
     jugador.GetComponent <Rigidbody2D>().velocity = new Vector2(0, jugador.GetComponent <Rigidbody2D>().velocity.y);
 }
Exemplo n.º 3
0
    void OnTriggerExit2D(Collider2D col)
    {
        if (col.name == "Player")
        {
            level.RespawnPlayer();
        }
        jugador.GetComponent <Rigidbody2D>().velocity = new Vector2(0, jugador.GetComponent <Rigidbody2D>().velocity.y);

        jugador.GetComponent <Rigidbody2D>().velocity = new Vector2(0, jugador.GetComponent <Rigidbody2D>().velocity.y);

        AudioClip clip;

        if (col.gameObject.name == "Player")
        {
            gameObject.GetComponent <AudioSource>().playOnAwake = false;
            clip = gameObject.GetComponent <AudioSource>().clip;
            AudioSource.PlayClipAtPoint(clip, new Vector3(0, 0, 0));
        }
    }