コード例 #1
0
ファイル: PawnGraphicSet.cs プロジェクト: KraigXu/GameProject
        public void ResolveAllGraphics()
        {
            ClearCache();
            if (pawn.RaceProps.Humanlike)
            {
                nakedGraphic               = GraphicDatabase.Get <Graphic_Multi>(pawn.story.bodyType.bodyNakedGraphicPath, ShaderDatabase.CutoutSkin, Vector2.one, pawn.story.SkinColor);
                rottingGraphic             = GraphicDatabase.Get <Graphic_Multi>(pawn.story.bodyType.bodyNakedGraphicPath, ShaderDatabase.CutoutSkin, Vector2.one, RottingColor);
                dessicatedGraphic          = GraphicDatabase.Get <Graphic_Multi>(pawn.story.bodyType.bodyDessicatedGraphicPath, ShaderDatabase.Cutout);
                headGraphic                = GraphicDatabaseHeadRecords.GetHeadNamed(pawn.story.HeadGraphicPath, pawn.story.SkinColor);
                desiccatedHeadGraphic      = GraphicDatabaseHeadRecords.GetHeadNamed(pawn.story.HeadGraphicPath, RottingColor);
                skullGraphic               = GraphicDatabaseHeadRecords.GetSkull();
                headStumpGraphic           = GraphicDatabaseHeadRecords.GetStump(pawn.story.SkinColor);
                desiccatedHeadStumpGraphic = GraphicDatabaseHeadRecords.GetStump(RottingColor);
                hairGraphic                = GraphicDatabase.Get <Graphic_Multi>(pawn.story.hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, pawn.story.hairColor);
                ResolveApparelGraphics();
                return;
            }
            PawnKindLifeStage curKindLifeStage = pawn.ageTracker.CurKindLifeStage;

            if (pawn.gender != Gender.Female || curKindLifeStage.femaleGraphicData == null)
            {
                nakedGraphic = curKindLifeStage.bodyGraphicData.Graphic;
            }
            else
            {
                nakedGraphic = curKindLifeStage.femaleGraphicData.Graphic;
            }
            if (pawn.RaceProps.packAnimal)
            {
                packGraphic = GraphicDatabase.Get <Graphic_Multi>(nakedGraphic.path + "Pack", ShaderDatabase.Cutout, nakedGraphic.drawSize, Color.white);
            }
            rottingGraphic = nakedGraphic.GetColoredVersion(ShaderDatabase.CutoutSkin, RottingColor, RottingColor);
            if (curKindLifeStage.dessicatedBodyGraphicData != null)
            {
                if (pawn.gender != Gender.Female || curKindLifeStage.femaleDessicatedBodyGraphicData == null)
                {
                    dessicatedGraphic = curKindLifeStage.dessicatedBodyGraphicData.GraphicColoredFor(pawn);
                }
                else
                {
                    dessicatedGraphic = curKindLifeStage.femaleDessicatedBodyGraphicData.GraphicColoredFor(pawn);
                }
            }
            if (!pawn.kindDef.alternateGraphics.NullOrEmpty())
            {
                Rand.PushState(pawn.thingIDNumber ^ 0xB415);
                if (Rand.Value <= pawn.kindDef.alternateGraphicChance)
                {
                    nakedGraphic = pawn.kindDef.alternateGraphics.RandomElementByWeight((AlternateGraphic x) => x.Weight).GetGraphic(nakedGraphic);
                }
                Rand.PopState();
            }
        }
コード例 #2
0
 public void ResolveAllGraphics()
 {
     this.ClearCache();
     if (this.pawn.RaceProps.Humanlike)
     {
         this.nakedGraphic               = GraphicDatabase.Get <Graphic_Multi>(this.pawn.story.bodyType.bodyNakedGraphicPath, ShaderDatabase.CutoutSkin, Vector2.one, this.pawn.story.SkinColor);
         this.rottingGraphic             = GraphicDatabase.Get <Graphic_Multi>(this.pawn.story.bodyType.bodyNakedGraphicPath, ShaderDatabase.CutoutSkin, Vector2.one, PawnGraphicSet.RottingColor);
         this.dessicatedGraphic          = GraphicDatabase.Get <Graphic_Multi>(this.pawn.story.bodyType.bodyDessicatedGraphicPath, ShaderDatabase.Cutout);
         this.headGraphic                = GraphicDatabaseHeadRecords.GetHeadNamed(this.pawn.story.HeadGraphicPath, this.pawn.story.SkinColor);
         this.desiccatedHeadGraphic      = GraphicDatabaseHeadRecords.GetHeadNamed(this.pawn.story.HeadGraphicPath, PawnGraphicSet.RottingColor);
         this.skullGraphic               = GraphicDatabaseHeadRecords.GetSkull();
         this.headStumpGraphic           = GraphicDatabaseHeadRecords.GetStump(this.pawn.story.SkinColor);
         this.desiccatedHeadStumpGraphic = GraphicDatabaseHeadRecords.GetStump(PawnGraphicSet.RottingColor);
         this.hairGraphic                = GraphicDatabase.Get <Graphic_Multi>(this.pawn.story.hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, this.pawn.story.hairColor);
         this.ResolveApparelGraphics();
     }
     else
     {
         PawnKindLifeStage curKindLifeStage = this.pawn.ageTracker.CurKindLifeStage;
         if (this.pawn.gender != Gender.Female || curKindLifeStage.femaleGraphicData == null)
         {
             this.nakedGraphic = curKindLifeStage.bodyGraphicData.Graphic;
         }
         else
         {
             this.nakedGraphic = curKindLifeStage.femaleGraphicData.Graphic;
         }
         this.rottingGraphic = this.nakedGraphic.GetColoredVersion(ShaderDatabase.CutoutSkin, PawnGraphicSet.RottingColor, PawnGraphicSet.RottingColor);
         if (this.pawn.RaceProps.packAnimal)
         {
             this.packGraphic = GraphicDatabase.Get <Graphic_Multi>(this.nakedGraphic.path + "Pack", ShaderDatabase.Cutout, this.nakedGraphic.drawSize, Color.white);
         }
         if (curKindLifeStage.dessicatedBodyGraphicData != null)
         {
             if (this.pawn.gender != Gender.Female || curKindLifeStage.femaleDessicatedBodyGraphicData == null)
             {
                 this.dessicatedGraphic = curKindLifeStage.dessicatedBodyGraphicData.GraphicColoredFor(this.pawn);
             }
             else
             {
                 this.dessicatedGraphic = curKindLifeStage.femaleDessicatedBodyGraphicData.GraphicColoredFor(this.pawn);
             }
         }
     }
 }