void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "ProtectionBase") { mainGoHealth = collision.gameObject.GetComponent <MainGoHealth>(); mainGoHealth.RemoveHealth(1); Destroy(gameObject); } if (Btype1) { if (collision.gameObject.tag == "Enemy") { Destroy(collision.gameObject); addEnemyKilled(); //ColliderOBJ.enabled = false; Destroy(gameObject); } //ColliderOBJ.enabled = false; } if (Btype2) { if (collision.gameObject.tag == "Enemy") { //addScore Destroy(collision.gameObject); addEnemyKilled(); } } }
void OnTriggerEnter(Collider col) { if (col.tag == "ProtectionBase") { mainGoHealth = col.gameObject.GetComponent <MainGoHealth>(); mainGoHealth.RemoveHealth(1); Destroy(gameObject); } }