コード例 #1
0
        public virtual IEnumerable <Thing> SmeltProducts(float efficiency)
        {
            List <ThingDefCountClass> costListAdj = def.CostListAdjusted(Stuff);

            for (int j = 0; j < costListAdj.Count; j++)
            {
                if (!costListAdj[j].thingDef.intricate)
                {
                    int num = GenMath.RoundRandom((float)costListAdj[j].count * 0.25f);
                    if (num > 0)
                    {
                        Thing thing = ThingMaker.MakeThing(costListAdj[j].thingDef);
                        thing.stackCount = num;
                        yield return(thing);
                    }
                }
            }
            if (def.smeltProducts != null)
            {
                for (int j = 0; j < def.smeltProducts.Count; j++)
                {
                    ThingDefCountClass thingDefCountClass = def.smeltProducts[j];
                    Thing thing2 = ThingMaker.MakeThing(thingDefCountClass.thingDef);
                    thing2.stackCount = thingDefCountClass.count;
                    yield return(thing2);
                }
            }
        }
コード例 #2
0
ファイル: Thing.cs プロジェクト: potsh/RimWorld
        public virtual IEnumerable <Thing> SmeltProducts(float efficiency)
        {
            List <ThingDefCountClass> costListAdj = def.CostListAdjusted(Stuff);

            for (int j = 0; j < costListAdj.Count; j++)
            {
                if (!costListAdj[j].thingDef.intricate)
                {
                    float countF = (float)costListAdj[j].count * 0.25f;
                    int   count  = GenMath.RoundRandom(countF);
                    if (count > 0)
                    {
                        Thing t = ThingMaker.MakeThing(costListAdj[j].thingDef);
                        t.stackCount = count;
                        yield return(t);

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                }
            }
            if (def.smeltProducts != null)
            {
                int i = 0;
                if (i < def.smeltProducts.Count)
                {
                    ThingDefCountClass ta = def.smeltProducts[i];
                    Thing t2 = ThingMaker.MakeThing(ta.thingDef);
                    t2.stackCount = ta.count;
                    yield return(t2);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
        }