void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Player") { other.GetComponent <Rigidbody2D> ().AddForce(force * direction, ForceMode2D.Impulse); thePlayer.hit(damage); } //other.GetComponent<Rigidbody2D> ().AddForce (force * direction,ForceMode2D.Impulse); }
void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "Player") { meteorSounds.PlayOneShot(crashSound); if (GManager.fuel > 0) { player.hit(1); } } else if (other.gameObject.tag == "Meteor" && isExplody == false) { meteorSounds.PlayOneShot(crashSound); } else if (other.gameObject.tag == "Meteor" && isExplody == true) { meteorSounds.PlayOneShot(explodeSound); dead = true; } }