void OnTriggerExit(Collider other) { if (other.tag == "Parachute") { position1 = other.transform.position; position2.y = position1.y - 0.4f; position2.z = position1.z; if (position1.x > 0) { position2.x = position1.x + 0.7f; gameControl.Count_left(); Instantiate(Paratroop, position2, Quaternion.Euler(0, 270, 0)); } else if (position1.x < 0) { position2.x = position1.x + 2.3f; gameControl.Count_right(); Instantiate(Paratroop, position2, Quaternion.Euler(0, 50, 0)); } // Debug.Log(position1); gameControl.AddScore(-5); } Destroy(other.gameObject); }
void OnTriggerEnter(Collider other) { Debug.Log(other.tag); if (other.tag == "Boundary") { return; } if (explosion != null && other.tag != "Helicopter" && other.tag != "Parachute" && other.tag != "Helicopter1" && other.tag != "Player") { Instantiate(explosion, transform.position, transform.rotation); } if (other.tag == "Bomb1" && gameObject.tag == "Tank") { Destroy(other.gameObject); GameObject g = GameObject.FindGameObjectWithTag("Player"); Destroy(g); Destroy(gameObject); GameController.GameOver(); } if ((other.tag == "Player" && gameObject.tag != "Tank") || other.tag == "Tank") { aud.Play(0); // Instantiate(playerExplosion, other.transform.position, other.transform.rotation); //gameController.GameOver(); //gameController.AddScore(scoreValue); //Destroy(other.gameObject); Destroy(gameObject, aud.clip.length / 10); } else { if (other.tag == "Enemy" && gameObject.tag != "Tank") { aud.Play(0); GameController.AddScore(scoreValue); Destroy(other.gameObject, aud.clip.length / 10); Destroy(gameObject, aud.clip.length / 10); } } }