public void HitObject(GameObject g) { var health = g.GetComponent <Health>(); if (health != null) { health.Impact(Damage, transform.forward * ImpactForce, raySensor.GetRayHit(g).point); } explode(raySensor.GetRayHit(g).normal); }
public void HitObject(GameObject g) { var health = g.GetComponent <newHealth>(); var damage = Random.Range(damageMin, damageMax); if (health != null) { health.Impact(damage, transform.forward * ImpactForce, raySensor.GetRayHit(g).point, fromIndex); } explode(raySensor.GetRayHit(g).normal); }