Ejemplo n.º 1
0
    public IEnumerator RespawnPlayerCo()
    {
        Instantiate(deathParticle, player.transform.position, player.transform.rotation);
        player.enabled = false;
        player.GetComponent <Renderer>().enabled     = false;
        player.GetComponent <Rigidbody2D>().velocity = Vector2.zero;

        Debug.Log("respawn player..");
        player.transform.position = currentCheckPoint.transform.position;

        //IEnumeratorla çalışıyor
        yield return(new WaitForSeconds(delayTime));

        playerHealthManager.DoFullHealth();
        playerHealthManager.isDead = false;
        player.enabled             = true;
        player.GetComponent <Renderer>().enabled = true;
        player.knockbackCount = -0.1f;
        Instantiate(respawnParticle, player.transform.position, player.transform.rotation);
    }