private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Player") { levelmainScript main = (GameObject.FindGameObjectWithTag("Main")).GetComponent <levelmainScript>(); main.doDamage(damage); Destroy(this.gameObject, 0.1f); } }
private void OnCollisionEnter(Collision collision) { liveScript script = collision.gameObject.GetComponent <liveScript>(); if (collision.gameObject.tag == "Player") { levelmainScript main = (GameObject.FindGameObjectWithTag("Main")).GetComponent <levelmainScript>(); main.doDamage(10); Destroy(this.gameObject, 0.1f); } else { if (collision.gameObject.tag == "Shoot") { } else { Destroy(this.gameObject); } } }