void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.transform.tag == "Copter") { if (!instaKill) { if (fixedDamage) { //other.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); } } ObstacleHit(gameObject.tag); }
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) { if (other.tag.Equals("Copter") || other.tag.Equals("Hook")) { found = true; if (!once) { SoundMusic.PlaySound(bling); once = true; } if (isSapphire == false) { //PlayerPrefsExt.SetBool(rubyName, true); animator.Play("Collected"); } else { animator.Play("CollectSapphire"); } } }
public void PlayUsingHandler() { AudioClip c = clips[Random.Range(0, clips.Length)]; SoundMusic.PlaySound(c); }