Exemplo n.º 1
0
    IEnumerator TakingDamage()
    {
        float timer = 0;

        while (timer < invincibleTime)
        {
            spriteRenderer.color = Color.clear;
            yield return(new WaitForSeconds(0.05f));

            spriteRenderer.color = defaultColor;
            yield return(new WaitForSeconds(0.05f));

            timer += 0.1f;
        }
        spriteRenderer.color = defaultColor;
        canTakeDamage        = true;
        OnFinishDamage.Invoke();
    }
Exemplo n.º 2
0
    IEnumerator TakingDamage()// sistema pro delay ao receber dano, intervalo entre os danos recebidos
    {
        float timer = 0;

        while (timer < invicibleTime)
        {
            spriterenderer.color = Color.clear;
            yield return(new WaitForSeconds(0.05f));

            spriterenderer.color = defaultColor;
            yield return(new WaitForSeconds(0.05f));

            timer += 0.1f;
        }

        spriterenderer.color = defaultColor;
        canTakeDamage        = true;
        OnFinishDamage.Invoke();
    }