private void Awake() { m_ExplosionParticles = Instantiate(m_ExplosionPrefab).GetComponent <ParticleSystem>(); m_ExplosionAudio = m_ExplosionParticles.GetComponent <AudioSource>(); cameraControl = FindObjectOfType <CameraControl>(); tankDamaged = GetComponentInChildren <TankDamaged>(); m_ExplosionParticles.gameObject.SetActive(false); }
private void Awake() { // Instantiate the explosion prefab and get a reference to the particle system on it. m_ExplosionParticles = Instantiate(m_ExplosionPrefab).GetComponent <ParticleSystem>(); // Get a reference to the audio source on the instantiated prefab. m_ExplosionAudio = m_ExplosionParticles.GetComponent <AudioSource>(); tankDamaged = GetComponentInChildren <TankDamaged>(); // Disable the prefab so it can be activated when it's required. m_ExplosionParticles.gameObject.SetActive(false); }