Ejemplo n.º 1
0
 void OnHit(DamageVector damageVector)
 {
     int damage = (int)(damageVector.physicalDamage - (stats.resistance * 0.2));
     BroadcastMessage("OnDamageTaken", damage);
     hp -= damage;
     UpdateSlider();
     if (hp <= 0)
         Destroy(gameObject);
 }
Ejemplo n.º 2
0
 void OnTriggerEnter2D(Collider2D attacker)
 {
     if (attacker.tag == "HitBox" && animator.GetCurrentAnimatorStateInfo(0).shortNameHash != blockHash)
     {
         Stats stats = attacker.GetComponentInParent<Stats>();
         DamageVector damageVector = new DamageVector()
         { physicalDamage = stats.strength };
         BroadcastMessage("OnHit", damageVector);
     }
 }