// MonoBehaviour's INTERFACE

    void Awake()
    {
        GameObject gameCameraGo = GameObject.FindGameObjectWithTag("GameCamera");

        if (gameCameraGo != null)
        {
            m_ScreenShake = gameCameraGo.GetComponentInChildren <tnScreenShake>();
        }

        // Set sort order.

        sortOrder = BehaviourSortOrder.s_SortOrder_Shake;
    }
        // INTERNALS

        private bool UpdateCache(GameObject i_Go)
        {
            if (i_Go == null)
            {
                return(false);
            }

            if (m_Target == null || m_CachedGameObject != i_Go)
            {
                m_Target           = i_Go.GetComponentInChildren <tnScreenShake>();
                m_CachedGameObject = i_Go;
            }

            return(m_Target != null);
        }
    protected override void OnGoal(tnGoalEventParams i_Params)
    {
        base.OnGoal(i_Params);

        int currentTick = TrueSyncManager.ticksMain;

        if (!m_GoalEffectsTicks.Contains(currentTick))
        {
            // Play effects.

            SfxPlayer.PlayMain(m_GoalSfx);

            // Play celebration animation and screen shake.

            tnScreenShake screenShake = null;
            tnGameCamera  gameCamera  = cameraGo.GetComponent <tnGameCamera>();
            if (gameCamera != null)
            {
                screenShake = gameCamera.GetComponentInChildren <tnScreenShake>();
            }

            if (m_CelebrationPanel != null)
            {
                m_CelebrationPanel.SetCelebrationText(i_Params.scorerId);
                m_CelebrationPanel.StartCelebration();
            }

            if (screenShake != null)
            {
                screenShake.ForceShake(m_CelebrationShakeTime, m_CelebrationShakeAmount, ShakeMode.Interruput);
            }

            m_GoalEffectsTicks.Add(currentTick);
        }

        // Update results.

        for (int teamResultsIndex = 0; teamResultsIndex < teamsCount; ++teamResultsIndex)
        {
            tnStandardMatchTeamResults teamResults = (tnStandardMatchTeamResults)GetTeamResultsByIndex(teamResultsIndex);
            if (teamResults != null)
            {
                if (teamResults.id != i_Params.teamId) // Assign a score to the team.
                {
                    ++teamResults.score;
                }
            }
        }

        if (i_Params.hasValidScorer)
        {
            if (!i_Params.isOwnGoal)
            {
                tnStandardMatchCharacterResults characterResults = (tnStandardMatchCharacterResults)GetCharacterResultsById(i_Params.scorerId);
                if (characterResults != null)
                {
                    ++characterResults.goalScored;
                }
            }
        }
    }
 void Start()
 {
     m_Shake = FindObjectOfType <tnScreenShake>();
 }