private void CheckPogbaGoal(tnGoalEventParams i_Params)
    {
        if (!i_Params.hasValidScorer)
        {
            return;
        }

        int scorerId = i_Params.scorerId;

        if (scorerId == s_PogbaHashedId)
        {
            bool humanScorer = i_Params.isHumanScorer;
            bool isLocal     = i_Params.isLocalScorer;

            if (humanScorer && isLocal)
            {
                StatsModule statsModule = GameServices.GetModuleMain <StatsModule>();
                if (statsModule != null)
                {
                    statsModule.UpdateIntStat(tnUserStatsId.s_PogbaStatId, 1, IntStatUpdateFunction.Add);
                    statsModule.StoreStats();
                }
            }
        }
    }
コード例 #2
0
    private void OnGoalOccurred(tnGoalEventParams i_Params)
    {
        if (m_Params == null)
        {
            return;
        }

        InternalSetVibrationValues(m_Params.goalIntensity, m_Params.goalDuration);
    }
    // EVENTS

    private void OnGoal(tnGoalEventParams i_Params)
    {
        CheckIbrahimovicGoal(i_Params);
        CheckVardyGoal(i_Params);
        CheckRonaldoGoal(i_Params);
        CheckElSharaawyGoal(i_Params);
        CheckIniestaGoal(i_Params);
        CheckGotzeGoal(i_Params);
        CheckHazardGoal(i_Params);
        CheckPogbaGoal(i_Params);
    }
コード例 #4
0
    // TrueSyncBehaviour's interface

    public override void OnSyncedTriggerEnter(TSCollision2D i_Collision)
    {
        if (!i_Collision.collider.CompareTag(Tags.s_Ball))
        {
            return;
        }

        if (m_TeamId == Hash.s_NULL)
        {
            return;
        }

        tnGoalEventParams goalEventParams = new tnGoalEventParams();

        goalEventParams.SetTeamId(m_TeamId);

        goalEventParams.SetHasValidScorer(false);

        {
            // Try to assign a valid scorer.

            tnKickable kickable = i_Collision.gameObject.GetComponent <tnKickable>();
            if (kickable != null)
            {
                for (int touchIndex = 0; touchIndex < kickable.touchesCount; ++touchIndex)
                {
                    tnTouch ballTouch = kickable.GetTouch(touchIndex);

                    if (m_TeamId != ballTouch.teamId)
                    {
                        goalEventParams.SetScorerId(ballTouch.characterId);
                        goalEventParams.SetScorerTeamId(ballTouch.teamId);

                        goalEventParams.SetIsHumanScorer(ballTouch.isHuman);
                        goalEventParams.SetIsLocalScorer(ballTouch.isLocal);

                        goalEventParams.SetHasValidScorer(true);

                        break;
                    }
                }
            }
        }

        // Send event.

        Messenger.Broadcast <tnGoalEventParams>("Goal", goalEventParams);
    }
    // EVENTS

    private void OnGoalEvent(tnGoalEventParams i_Params)
    {
        if (m_Waiting)
        {
            return;
        }

        if (m_GoalTick != 0)
        {
            return;
        }

        int currentTick = TrueSyncManager.ticksMain;

        m_GoalTick        = currentTick;
        m_GoalParamsCache = i_Params;
    }
    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;
                }
            }
        }
    }
 protected virtual void OnGoal(tnGoalEventParams i_Params)
 {
 }