public void dealDamage(GameObject reciever) { isHit = true; DamagableEntity rec = reciever.GetComponent <DamagableEntity>(); rec.incomingDmg = attdmg; rec.damage(); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Enemy" && type == "sword") { print("enemy"); } if (other.gameObject.tag == "Enemy" && type == "sword" && isSwinging && Time.time - startTime2 > 0.5) { DamagableEntity enemy = other.gameObject.GetComponent <DamagableEntity>(); enemy.incomingDmg = sworddmg; enemy.damage(); print("hit"); startTime2 = Time.time; } }