public void Hit() { //Debug.Log("Hit: " + the_collision.transform.name); IHealthPool hithealth = the_collision.transform.GetComponent <IHealthPool>(); if (hithealth != null) { //Debug.Log("Damaged: " + the_collision.transform.name); hithealth.Damage(PulseDamage); } Vector3 spawn_point = the_collision.contacts[0].point; Despawn(); }
public void Hit() { Debug.Log("Hit: " + the_collision.transform.name); IHealthPool hithealth = the_collision.transform.GetComponent <IHealthPool>(); if (hithealth != null) { Debug.Log("Damaged: " + the_collision.transform.name); hithealth.Damage(RocketDamage); } Vector3 spawn_point = the_collision.contacts[0].point; GameObject decal = Instantiate(ExplosionDecal); decal.transform.position = spawn_point; decal.transform.parent = null; Despawn(); }
public void Launch(Vector3 position, Vector3 direction) { RaycastHit rayhit; //look into collision layers directionVec = direction; bool hit = Physics.Raycast(transform.position, directionVec, out rayhit); if (hit) { Vector3 rayposition = rayhit.point; IHealthPool hithealth = rayhit.transform.GetComponent <IHealthPool>(); if (hithealth != null) { hithealth.Damage(BulletDamage); } GameObject decal = Instantiate(BulletHoleDecal); decal.transform.position = rayposition; } StartCoroutine(despawn()); }