示例#1
0
    void OnTriggerEnter2D(Collider2D collidedObject)
    {
        if (collidedObject.tag == "Player")
        {
            collidedObject.SendMessage("hitDeathTrigger");
            player.resetStatus();

            if (MusicSource.MUSIC_OBJECT == null)
            {
                MusicSource.buscarObjetoMusica(); //BUSCO EL OBJETO QUE CONTIENE LA MUSICA DE FONDO
            }

            new ControlMusica(MusicSource.MUSIC_OBJECT).pararMusica(); //PARO LA MUSICA
            GetComponent <AudioSource>().Play();
        }
    }
    private IEnumerator resurrecion()
    {
        yield return(new WaitForSeconds(resurrect_time));

        transform.position = playerRespawnPoint.transform.position; //posicio: la de PlayerRespawnPoint
        transform.rotation = Quaternion.identity;                   //rotacio: cap
        GetComponent <Rigidbody2D>().velocity = Vector2.zero;       //velocitat lineal: zero

        //GESTIONO QUE LA MUSICA VUELVA A SONAR
        if (MusicSource.MUSIC_OBJECT == null)
        {
            MusicSource.buscarObjetoMusica();                     //BUSCO EL OBJETO QUE CONTIENE LA MUSICA DE FONDO
        }
        new ControlMusica(MusicSource.MUSIC_OBJECT).playMusica(); //REANUDO LA MUSICA

        PlayerStateController.muerto = false;
        Jump.plataformaTocada        = true;
        playerWalkSpeed = playerSpeedAuxiliar;
    }