private void OnDeath() { // Set the flag so that this function is only called once. m_Dead = true; // Move the instantiated explosion prefab to the tank's position and turn it on. m_ExplosionParticles.transform.position = transform.position; m_ExplosionParticles.gameObject.SetActive(true); // Play the particle system of the tank exploding. m_ExplosionParticles.Play(); // Play the tank explosion sound effect. m_ExplosionAudio.Play(); // Turn the tank off. gameObject.SetActive(false); Director director = Director.GetInstance(); FirstController fc = (FirstController)director.CurrentScenceController; if (isAI) { fc.AddScore(); } else { fc.GameOver(); } }