예제 #1
0
 void IMutationEventReceiver.MutationRemoved(Hediff_AddedMutation mutation, MutationTracker tracker)
 {
     foreach (IMutationEventReceiver affinity in _aspects.OfType <IMutationEventReceiver>())
     {
         affinity.MutationRemoved(mutation, tracker);
     }
 }
예제 #2
0
        private void NotifyCompsRemoved(Hediff_AddedMutation mutation)
        {
            foreach (ThingComp parentAllComp in parent.AllComps)
            {
                if (parentAllComp == this)
                {
                    continue;
                }
                if (!(parentAllComp is IMutationEventReceiver receiver))
                {
                    continue;
                }
                receiver.MutationRemoved(mutation, this);
            }

            var hediffs = Pawn.health?.hediffSet?.hediffs;

            if (hediffs != null)
            {
                foreach (Hediff hediff in hediffs)
                {
                    if (hediff is IMutationEventReceiver receiver)
                    {
                        receiver.MutationRemoved(mutation, this);
                    }
                    else if (hediff is HediffWithComps hComps)
                    {
                        foreach (IMutationEventReceiver eventReceiver in hComps.comps.MakeSafe().OfType <IMutationEventReceiver>())
                        {
                            eventReceiver.MutationRemoved(mutation, this);
                        }
                    }
                }
            }
        }
예제 #3
0
        /// <summary> Called to notify this tracker that a mutation has been removed. </summary>
        public void NotifyMutationRemoved([NotNull] Hediff_AddedMutation mutation)
        {
            if (mutation == null)
            {
                throw new ArgumentNullException(nameof(mutation));
            }
            _mutationList.Remove(mutation);
            MutationsCount -= 1;

            InfluencesDirty = true;
        }
예제 #4
0
        /// <summary> Called to notify this tracker that a mutation has been added. </summary>
        public void NotifyMutationAdded([NotNull] Hediff_AddedMutation mutation)
        {
            if (mutation == null)
            {
                throw new ArgumentNullException(nameof(mutation));
            }
            _mutationList.Add(mutation);

            InfluencesDirty = true;

            NotifyCompsAdded(mutation);
        }
예제 #5
0
        /// <summary> Called to notify this tracker that a mutation has been removed. </summary>
        public void NotifyMutationRemoved([NotNull] Hediff_AddedMutation mutation)
        {
            if (mutation == null)
            {
                throw new ArgumentNullException(nameof(mutation));
            }
            _mutationList.Remove(mutation);
            MutationsCount -= 1;

            AnimalClassUtilities.FillInfluenceDict(_mutationList, _influenceDict);

            TotalInfluence = _influenceDict.Select(s => s.Value).Sum();
            NotifyCompsRemoved(mutation);
        }
예제 #6
0
 private void NotifyCompsRemoved(Hediff_AddedMutation mutation)
 {
     foreach (ThingComp parentAllComp in parent.AllComps)
     {
         if (parentAllComp == this)
         {
             continue;
         }
         if (!(parentAllComp is IMutationEventReceiver receiver))
         {
             continue;
         }
         receiver.MutationRemoved(mutation, this);
     }
 }