Esempio n. 1
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);
 }
Esempio n. 2
0
    public IEnumerator respawnPlayer()
    {
        Instantiate(particulaMuerte, player.transform.position, player.transform.rotation);
        player.enabled = false;
        player.GetComponent <Renderer>().enabled = false;
        yield return(new WaitForSeconds(tiempoReinicio));

        player.transform.position = currentCheckPoint.transform.position;
        Instantiate(particulaInicio, player.transform.position, player.transform.rotation);
        player.enabled = true;
        player.GetComponent <Renderer>().enabled = true;
    }
Esempio 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));
        }
    }