Пример #1
0
        public bool ColorApparel(Apparel apparel)
        {
#if DEBUG || DEBUG_APPAREL_COLOR
            Log.Warning("Start PawnOutfits.ColorApparel(Apparel: " + apparel.Label + ")");

            /*ApparelLayer debugLayer = apparel.def.apparel.LastLayer;
             * Log.Message(Environment.NewLine + "Start PawnOutfits.TryGetColorFor Layer: " + debugLayer + " " + ((int)debugLayer).ToString());
             *
             * System.Text.StringBuilder sb = new System.Text.StringBuilder();
             * for (int i = 0; i < this.IsColorAssigned.Count; ++i)
             * {
             *  sb.Append(this.IsColorAssigned[i]);
             *  if (this.ColorForLayer != null)
             *  {
             *      sb.Append(" ");
             *      sb.Append(this.ColorForLayer[i].ToString());
             *  }
             *  sb.Append(" -- ");
             * }
             * Log.Warning(sb.ToString());*/
#endif
            if (!HaveColorsBeenAssigned)
            {
#if DEBUG || DEBUG_APPAREL_COLOR
                Log.Message("    No colors assigned yet");
#endif
                return(true);
            }

            foreach (ApparelLayer layer in apparel.def.apparel.layers)
            {
#if DEBUG || DEBUG_APPAREL_COLOR
                Log.Message("    Layer: " + layer);
#endif
                if ((int)layer < this.IsColorAssigned.Count &&
                    this.IsColorAssigned[(int)layer] == true)
                {
                    apparel.SetColor(this.ColorForLayer[(int)layer]);
#if DEBUG || DEBUG_APPAREL_COLOR
                    Log.Message("        Set color to: " + this.ColorForLayer[(int)layer]);
#endif
                    return(true);
                }
#if DEBUG || DEBUG_APPAREL_COLOR
                else
                {
                    Log.Message("        No color set for layer");
                }
#endif
            }

#if DEBUG || DEBUG_APPAREL_COLOR
            Log.Message("    No color match found");
#endif
            return(false);
        }
Пример #2
0
        // Token: 0x0600007A RID: 122 RVA: 0x00004CA8 File Offset: 0x00002EA8
        private Apparel MakeApparel(int index)
        {
            ThingDef def     = this.data.wornApparelDefs[index];
            Apparel  apparel = (Apparel)ThingMaker.MakeThing(def, GenStuff.DefaultStuffFor(def));

            if (this.data.wornApparelColors.Count > index && this.data.wornApparelDefs[index] != null)
            {
                apparel.SetColor(this.data.wornApparelColors[index], false);
            }
            return(apparel);
        }
Пример #3
0
        public static void GeneratePawnApparel(ref Pawn pawn, QualityCategory apparelQuality, ThingDef apparelDef, ThingDef apparelStuff, Color apparelColor, bool applyColor = true)
        {
            Apparel apparel = ThingMaker.MakeThing(apparelDef, apparelStuff) as Apparel;

            if (applyColor)
            {
                apparel.SetColor(apparelColor);
            }
            apparel.TryGetComp <CompQuality>().SetQuality(apparelQuality, ArtGenerationContext.Outsider);
            pawn.apparel.Wear(apparel, false);
        }
 private static void DressNakedZombie(Zombie pawn)
 {
     if (pawn.apparel.WornApparelCount == 0)
     {
         //90% chance of a top
         if (Rand.Value > 0.1f)
         {
             ThingDef top        = Rand.Value > 0.3f ? ThingDef.Named("Apparel_BasicShirt") : ThingDef.Named("Apparel_CollarShirt");
             Apparel  topApparel = (Apparel)ThingMaker.MakeThing(top, ThingDefOf.Cloth);
             topApparel.HitPoints = Rand.Range((topApparel.MaxHitPoints / 6), (topApparel.MaxHitPoints / 2));
             topApparel.SetColor(GenColor.FromBytes(Rand.Range(98, 155), Rand.Range(106, 129), Rand.Range(90, 129)));
             pawn.apparel.Wear(topApparel, false);
         }
         //95% chance of having pants
         if (Rand.Value > 0.05f)
         {
             ThingDef bottom        = Rand.Value > 0.05f ? ThingDef.Named("Apparel_Pants") : ThingDef.Named("Apparel_FlakPants");
             Apparel  bottomApparel = (Apparel)ThingMaker.MakeThing(bottom, bottom == ThingDef.Named("Apparel_Pants") ? ThingDefOf.Cloth : null);
             bottomApparel.HitPoints = Rand.Range((bottomApparel.MaxHitPoints / 6), (bottomApparel.MaxHitPoints / 2));
             pawn.apparel.Wear(bottomApparel, false);
         }
     }
 }