void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.transform.tag == "Copter") { if (!instaKill) { if (!fixedDamage) { //collision.gameObject.GetComponent<Copter>().health.TakeDamage(collision.relativeVelocity.magnitude * damageMultiplier); } else { //collision.gameObject.GetComponent<Copter>().health.TakeDamage(fixedDamageAmount); } } else { copter.Detonate(); } if (diesOnContact && deathAnimation != null) { Instantiate(deathAnimation, transform.position, Quaternion.identity); } if (diesOnContact) { if (deathSound != null) { SoundMusic.PlaySound(deathSound); } Destroy(gameObject); } } if (collision.gameObject.transform.tag == "Hook") { if (killsHook) { copter.rope.KillHook(); } /*if (diesOnContact && deathAnimation != null) * Instantiate (deathAnimation, transform.position, Quaternion.identity); * if (diesOnContact) Destroy(gameObject);*/ } ObstacleHit(gameObject.tag); }
void OnTriggerEnter2D(Collider2D other) { Copter copter = other.GetComponent <Copter>(); if (copter != null) { copter.Detonate(); } }
void OnCollisionEnter2D(Collision2D collision) { string tag = collision.gameObject.tag; if (tag.Equals("Copter")) { copter.Detonate(); } else if (tag.Equals("Hook")) { copter.rope.KillHook(); } }