private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { //Add points ShipStats.AddPoints(10); //Make effect //Destroy Destroy(this.gameObject); } }
void OnTriggerEnter(Collider other) { Target tar = other.GetComponent <Target>(); if (tar != null) { tar.TakeDamage(40f); if (tar.tag == "Meteor") { //Shrink it out //other.transform.localScale = new Vector3(other.transform.localScale.x-0.05f ,other.transform.localScale.y-0.05f ,other.transform.localScale.z-0.05f ); if (tar.health <= 0) { ShipStats.AddPoints(10); } GameObject temp = Instantiate(imapact, this.transform.position, Quaternion.identity); Destroy(temp, 2f); } } Destroy(this.gameObject); }