Пример #1
0
        /// <summary> Notify the map that the pawn has despawned from the map. </summary>
        public void NotifyDespawned(Pawn pawn)
        {
            var morph = pawn.def.GetMorphOfRace();

            if (morph != null)
            {
                var i = _counterDict.TryGetValue(morph) - 1;
                i = Mathf.Max(0, i);
                _counterDict[morph] = i;
                MorphCountChanged?.Invoke(this, morph);
            }
        }
Пример #2
0
        /// <summary> Notify this tracker that the pawn race has changed. </summary>
        public void NotifyPawnRaceChanged(Pawn pawn, [CanBeNull] MorphDef oldMorph)
        {
            if (oldMorph != null)
            {
                var i = _counterDict.TryGetValue(oldMorph) - 1;
                i = Mathf.Max(0, i);
                _counterDict[oldMorph] = i;

                MorphCountChanged?.Invoke(this, oldMorph);
            }

            var morph = pawn.def.GetMorphOfRace();

            if (morph != null)
            {
                var i = _counterDict.TryGetValue(morph) + 1;
                _counterDict[morph] = i;
                MorphCountChanged?.Invoke(this, morph);
            }
        }