void OnCollisionEnter(Collision col) { Debug.Log(col.transform.name); if (col.transform.tag == "NPC") { Debug.Log(col.transform.name); if (dp != null) { dp.ProvideDamage(col.transform); } Debug.Log("Ho colpito collision"); } }
void OnCollisionEnter(Collision col) { if (canBounce) { BulletBouncer bb = col.transform.GetComponent <BulletBouncer> (); if (bb != null && bb.active) { if (bb.target != null) { Rigidbody br = transform.GetComponent <Rigidbody> (); br.velocity = (bb.target.position - transform.position).normalized * br.velocity.magnitude; } return; } } ExplosionGenerator eg = GetComponent <ExplosionGenerator> (); if (eg != null) { eg.Detonate(col.transform); } if (dp != null) { dp.ProvideDamage(col.transform); } Destroy(gameObject); }
public void Fire(Transform t) { if (bigTimer <= 0f) { end = t == null ? transform.position + transform.root.forward * maxDistance : t.position; if (dp != null) { dp.ProvideDamage(t); } bigTimer = totalDuration; } }
public void attack() { if (currentTarget != null) { Debug.Log("SONO: " + currentTarget.gameObject.name); dp.ProvideDamage(currentTarget); } else { Debug.Log("Nessun Target"); } }
void OnCollisionEnter(Collision col) { if (onContact) { ExplosionGenerator eg = GetComponent <ExplosionGenerator> (); if (eg != null) { eg.Detonate(null); } if (dp != null) { dp.ProvideDamage(col.transform); } Destroy(gameObject); } }