コード例 #1
0
 public IEnumerable <Thing> GenerateThings()
 {
     if (Rand.Value >= this.skipChance)
     {
         if (this.thingDef != null && this.countRange.max > 0)
         {
             Thing thing = ThingMaker.MakeThing(this.thingDef, null);
             thing.stackCount = this.countRange.RandomInRange;
             yield return(thing);
         }
         if (this.subOptionsTakeAll != null)
         {
             foreach (PawnInventoryOption opt in this.subOptionsTakeAll)
             {
                 foreach (Thing subThing in opt.GenerateThings())
                 {
                     yield return(subThing);
                 }
             }
         }
         if (this.subOptionsChooseOne != null)
         {
             PawnInventoryOption chosen = this.subOptionsChooseOne.RandomElementByWeight((PawnInventoryOption o) => o.choiceChance);
             foreach (Thing subThing2 in chosen.GenerateThings())
             {
                 yield return(subThing2);
             }
         }
     }
 }
コード例 #2
0
 public IEnumerable <Thing> GenerateThings()
 {
     if (!(Rand.Value < skipChance))
     {
         if (thingDef != null && countRange.max > 0)
         {
             Thing thing = ThingMaker.MakeThing(thingDef);
             thing.stackCount = countRange.RandomInRange;
             yield return(thing);
         }
         if (subOptionsTakeAll != null)
         {
             foreach (PawnInventoryOption item in subOptionsTakeAll)
             {
                 foreach (Thing item2 in item.GenerateThings())
                 {
                     yield return(item2);
                 }
             }
         }
         if (subOptionsChooseOne != null)
         {
             PawnInventoryOption pawnInventoryOption = subOptionsChooseOne.RandomElementByWeight((PawnInventoryOption o) => o.choiceChance);
             foreach (Thing item3 in pawnInventoryOption.GenerateThings())
             {
                 yield return(item3);
             }
         }
     }
 }
コード例 #3
0
        public IEnumerable <Thing> GenerateThings()
        {
            if (!(Rand.Value < this.skipChance))
            {
                if (this.thingDef != null && this.countRange.max > 0)
                {
                    Thing thing = ThingMaker.MakeThing(this.thingDef, null);
                    thing.stackCount = this.countRange.RandomInRange;
                    yield return(thing);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
                if (this.subOptionsTakeAll != null)
                {
                    foreach (PawnInventoryOption item in this.subOptionsTakeAll)
                    {
                        using (IEnumerator <Thing> enumerator2 = item.GenerateThings().GetEnumerator())
                        {
                            if (enumerator2.MoveNext())
                            {
                                Thing subThing2 = enumerator2.Current;
                                yield return(subThing2);

                                /*Error: Unable to find new state assignment for yield return*/;
                            }
                        }
                    }
                }
                if (this.subOptionsChooseOne != null)
                {
                    PawnInventoryOption chosen = this.subOptionsChooseOne.RandomElementByWeight((PawnInventoryOption o) => o.choiceChance);
                    using (IEnumerator <Thing> enumerator3 = chosen.GenerateThings().GetEnumerator())
                    {
                        if (enumerator3.MoveNext())
                        {
                            Thing subThing = enumerator3.Current;
                            yield return(subThing);

                            /*Error: Unable to find new state assignment for yield return*/;
                        }
                    }
                }
            }
            yield break;
IL_0299:
            /*Error near IL_029a: Unexpected return in MoveNext()*/;
        }