Пример #1
0
        public override bool FilterApplies(Thing thing)
        {
            Pawn pawn = thing as Pawn;

            if (pawn == null)
            {
                return(false);
            }

            if (pawn.needs?.TryGetNeed <Need_Mood>() is Need_Mood mood)
            {
                //memories
                if (mood.thoughts.memories.Memories.Any(t => t.def == Sel && stageRange.Includes(t.CurStageIndex)))
                {
                    return(true);
                }

                //situational
                List <Thought> thoughts = new List <Thought>();
                mood.thoughts.situational.AppendMoodThoughts(thoughts);
                if (thoughts.Any(t => t.def == Sel && stageRange.Includes(t.CurStageIndex)))
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
        public void should_include_when_after_number_grow_is_between_low_and_high()
        {
            var intRange = new IntRange(50, 100);

            intRange.Grow(2);
            Assert.True(intRange.Includes(150));
        }
Пример #3
0
 public override bool AllowPlayerStartingPawn(Pawn pawn, bool tryingToRedress, PawnGenerationRequest req)
 {
     return(allowedAgeRange.Includes(pawn.ageTracker.AgeBiologicalYears));
 }
Пример #4
0
 public virtual void TryPlay(SoundInfo info)
 {
     if (resolvedGrains.Count == 0)
     {
         Log.Error(string.Concat("Cannot play ", parentDef, " (subSound ", this, "_: No resolved grains."));
     }
     else
     {
         if (!Find.SoundRoot.oneShotManager.CanAddPlayingOneShot(parentDef, info) || (Current.Game != null && !gameSpeedRange.Includes((int)Find.TickManager.CurTimeSpeed)))
         {
             return;
         }
         ResolvedGrain      resolvedGrain      = RandomizedResolvedGrain();
         ResolvedGrain_Clip resolvedGrain_Clip = resolvedGrain as ResolvedGrain_Clip;
         if (resolvedGrain_Clip != null)
         {
             if (SampleOneShot.TryMakeAndPlay(this, resolvedGrain_Clip.clip, info) == null)
             {
                 return;
             }
             SoundSlotManager.Notify_Played(parentDef.slot, resolvedGrain_Clip.clip.length);
         }
         if (distinctResolvedGrainsCount <= 1)
         {
             return;
         }
         if (repeatMode == RepeatSelectMode.NeverLastHalf)
         {
             while (recentlyPlayedResolvedGrains.Count >= numToAvoid)
             {
                 recentlyPlayedResolvedGrains.Dequeue();
             }
             if (recentlyPlayedResolvedGrains.Count < numToAvoid)
             {
                 recentlyPlayedResolvedGrains.Enqueue(resolvedGrain);
             }
         }
         else if (repeatMode == RepeatSelectMode.NeverTwice)
         {
             lastPlayedResolvedGrain = resolvedGrain;
         }
     }
 }
 public void should_not_include_when_number_is_less_than_low_and_greater_than_high()
 {
     var intRange = new IntRange(50, 100);
     Assert.False(intRange.Includes(150));
 }
 public void should_include_when_number_is_between_low_and_high()
 {
     var intRange = new IntRange(50, 100);
     Assert.True(intRange.Includes(80));
 }
 public void should_include_when_after_number_grow_is_between_low_and_high()
 {
     var intRange = new IntRange(50, 100);
     intRange.Grow(2);
     Assert.True(intRange.Includes(150));
 }
Пример #8
0
        public void should_not_include_when_number_is_less_than_low_and_greater_than_high()
        {
            var intRange = new IntRange(50, 100);

            Assert.False(intRange.Includes(150));
        }
Пример #9
0
        public void should_include_when_number_is_between_low_and_high()
        {
            var intRange = new IntRange(50, 100);

            Assert.True(intRange.Includes(80));
        }