Exemple #1
0
    public void OnCollisionStay2D(Collision2D collision)
    {
        if (collision.gameObject.layer == 9 && collision.gameObject.tag == "Enemy")
        {
            if (collision.gameObject.GetComponent <BattleStats>() != null)
            {
                battleStats.takeDamage(collision.gameObject.GetComponent <BattleStats>().finalAttackDamage());
            }
            else
            {
                battleStats.takeDamage(5);
                Debug.Log("Erreur, ennemi sans BattleStats");
            }


            battleStats.hitStun(collision.gameObject, 1, 0.35f);
            battleStats.enableInvicibilityFrames(invincibilitySeconds);
            StopAllCoroutines();
            anim.SetBool("isBlinking", true);
            StartCoroutine(waitThenDeblink());
        }
    }