private void HandleDown() { // If it's already ending, do nothing else. if (m_IsEnding) { return; } // Otherwise this is ending the target's lifetime. m_IsEnding = true; // Turn off the visual and physical aspects. m_Renderer.enabled = false; m_Collider.enabled = false; // Play the clip of the target being hit. m_Audio.clip = m_DestroyClip; m_Audio.Play(); // Calculation to the player's score SessionData.CalScore(m_Score); // Instantiate the shattered target prefab in place of this target. GameObject destroyedTarget = Instantiate(m_DestroyPrefab, transform.position, transform.rotation) as GameObject; // Destroy the shattered target after it's time out duration. Destroy(destroyedTarget, m_DestroyTimeOutDuration); // Tell subscribers that this target is ready to be removed. if (OnRemove != null) { OnRemove(this); } }