Example #1
0
    // Respawns a new player
    IEnumerator RespawnPlayer()
    {
        yield return(new WaitForSeconds(2.0f));

        playerSpawn.Respawn();
        yield return(new WaitForSeconds(2.0f));

        playerSpawn.EnableCollisions();
    }
Example #2
0
    IEnumerator DestroyPlayer()
    {
        _rigid.velocity = Vector2.down * 2 * Time.deltaTime;
        sr.enabled      = false;
        cc.enabled      = false;

        FindObjectOfType <AudioManager>().Play("PlayerDeath");

        particleSystem.Play();
        yield return(new WaitForSeconds(particleSystem.main.startLifetime.constantMax));

        playerSpawn.Respawn();
    }