private void OnObserverDisable(GameObject go, ParticipationObserver observer)
        {
            Competitor <GameObject> competitor = PriorityCompetition.GetCompetitor(go);

            if (competitor == null)
            {
                return;
            }
            bool flag = false;

            try
            {
                PriorityCompetition.RemoveCompetitor(go);
                if (participationData.CurrentParticipationState != ParticipationState.Retained)
                {
                    Internal_UpdateParticipationWhenSomethingGotRemoved(competitor, "Controller_triggerExit");
                    StopObserving(competitor);
                    flag = true;
                }
            }
            catch
            {
                ClearPriorityCompetition(competitor);
            }
        }
 public void StopObserving(Competitor <GameObject> competitor)
 {
     if (!(competitor?.Value.IsDestroyed() ?? true))
     {
         ParticipationObserver component = competitor.Value.GetComponent <ParticipationObserver>();
         if (component != null && !component.gameObject.IsDestroyed() && !base.gameObject.IsDestroyed())
         {
             component.StopObserving(base.gameObject);
             component.ObserverDisable -= OnObserverDisable;
             component.ObserverExit    -= OnObserverExit;
         }
     }
 }
        private void AddObserverAndListenersToParticipationRequestor(Competitor <GameObject> participant)
        {
            ParticipationObserver participationObserver = participant.Value.GetComponent <ParticipationObserver>();

            if (participationObserver == null)
            {
                participationObserver = participant.Value.AddComponent <ParticipationObserver>();
            }
            if (participationObserver != null && !participationObserver.IsObserving(base.gameObject))
            {
                participationObserver.StartObserving(base.gameObject, this, participant);
                participationObserver.ObserverExit    += OnObserverExit;
                participationObserver.ObserverDisable += OnObserverDisable;
            }
        }
        private void OnObserverExit(Competitor <GameObject> competitor, GameObject playerGameObject, ParticipationObserver observer)
        {
            Assert.IsTrue(playerGameObject == base.gameObject, "Not my player!");
            if (!(playerGameObject == base.gameObject) || PriorityCompetition.GetCompetitor(competitor.theObject) == null)
            {
                return;
            }
            bool flag = false;

            try
            {
                PriorityCompetition.RemoveCompetitor(competitor);
                if (participationData.CurrentParticipationState != ParticipationState.Retained)
                {
                    Internal_UpdateParticipationWhenSomethingGotRemoved(competitor, "triggerExit");
                    StopObserving(competitor);
                    flag = true;
                }
            }
            catch (Exception ex)
            {
                Log.LogException(this, ex);
                ClearPriorityCompetition(competitor);
            }
        }