Exemple #1
0
        public void RenderPawnAt(Vector3 drawLoc, RotDrawMode bodyDrawType, bool headStump)
        {
            if (!graphics.AllResolved)
            {
                graphics.ResolveAllGraphics();
            }
            if (pawn.GetPosture() == PawnPosture.Standing)
            {
                RenderPawnInternal(drawLoc, 0f, renderBody: true, bodyDrawType, headStump);
                if (pawn.carryTracker != null)
                {
                    Thing carriedThing = pawn.carryTracker.CarriedThing;
                    if (carriedThing != null)
                    {
                        Vector3 drawPos = drawLoc;
                        bool    behind  = false;
                        bool    flip    = false;
                        if (pawn.CurJob == null || !pawn.jobs.curDriver.ModifyCarriedThingDrawPos(ref drawPos, ref behind, ref flip))
                        {
                            drawPos = ((!(carriedThing is Pawn) && !(carriedThing is Corpse)) ? (drawPos + new Vector3(0.18f, 0f, 0.05f)) : (drawPos + new Vector3(0.44f, 0f, 0f)));
                        }
                        if (behind)
                        {
                            drawPos.y -= 0.0390625f;
                        }
                        else
                        {
                            drawPos.y += 0.0390625f;
                        }
                        carriedThing.DrawAt(drawPos, flip);
                    }
                }
                if (pawn.def.race.specialShadowData != null)
                {
                    if (shadowGraphic == null)
                    {
                        shadowGraphic = new Graphic_Shadow(pawn.def.race.specialShadowData);
                    }
                    shadowGraphic.Draw(drawLoc, Rot4.North, pawn);
                }
                if (graphics.nakedGraphic != null && graphics.nakedGraphic.ShadowGraphic != null)
                {
                    graphics.nakedGraphic.ShadowGraphic.Draw(drawLoc, Rot4.North, pawn);
                }
            }
            else
            {
                Rot4         rot          = LayingFacing();
                Building_Bed building_Bed = pawn.CurrentBed();
                bool         renderBody;
                float        angle;
                Vector3      rootLoc;
                if (building_Bed != null && pawn.RaceProps.Humanlike)
                {
                    renderBody = building_Bed.def.building.bed_showSleeperBody;
                    Rot4 rotation = building_Bed.Rotation;
                    rotation.AsInt += 2;
                    angle           = rotation.AsAngle;
                    AltitudeLayer altLayer = (AltitudeLayer)Mathf.Max((int)building_Bed.def.altitudeLayer, 15);
                    Vector3       vector   = pawn.Position.ToVector3ShiftedWithAltitude(altLayer);
                    Vector3       vector2  = vector;
                    vector2.y += 0.02734375f;
                    Vector3 vector3 = BaseHeadOffsetAt(Rot4.South);
                    float   d       = 0f - vector3.z;
                    Vector3 a       = rotation.FacingCell.ToVector3();
                    rootLoc    = vector + a * d;
                    rootLoc.y += 0.0078125f;
                }
                else
                {
                    renderBody = true;
                    rootLoc    = drawLoc;
                    if (!pawn.Dead && pawn.CarriedBy == null)
                    {
                        rootLoc.y = AltitudeLayer.LayingPawn.AltitudeFor() + 0.0078125f;
                    }
                    if (pawn.Downed || pawn.Dead)
                    {
                        angle = wiggler.downedAngle;
                    }
                    else if (pawn.RaceProps.Humanlike)
                    {
                        angle = rot.AsAngle;
                    }
                    else
                    {
                        Rot4 rot2 = Rot4.West;
                        switch (pawn.thingIDNumber % 2)
                        {
                        case 0:
                            rot2 = Rot4.West;
                            break;

                        case 1:
                            rot2 = Rot4.East;
                            break;
                        }
                        angle = rot2.AsAngle;
                    }
                }
                RenderPawnInternal(rootLoc, angle, renderBody, rot, rot, bodyDrawType, portrait: false, headStump);
            }
            if (pawn.Spawned && !pawn.Dead)
            {
                pawn.stances.StanceTrackerDraw();
                pawn.pather.PatherDraw();
            }
            DrawDebug();
        }
Exemple #2
0
 public void RenderPawnAt(Vector3 drawLoc, RotDrawMode bodyDrawType, bool headStump)
 {
     if (!this.graphics.AllResolved)
     {
         this.graphics.ResolveAllGraphics();
     }
     if (this.pawn.GetPosture() == PawnPosture.Standing)
     {
         this.RenderPawnInternal(drawLoc, Quaternion.identity, true, bodyDrawType, headStump);
         if (this.pawn.carryTracker != null)
         {
             Thing carriedThing = this.pawn.carryTracker.CarriedThing;
             if (carriedThing != null)
             {
                 Vector3 vector = drawLoc;
                 bool    flag   = false;
                 bool    flip   = false;
                 if (this.pawn.CurJob == null || !this.pawn.jobs.curDriver.ModifyCarriedThingDrawPos(ref vector, ref flag, ref flip))
                 {
                     if (carriedThing is Pawn || carriedThing is Corpse)
                     {
                         vector += new Vector3(0.44f, 0f, 0f);
                     }
                     else
                     {
                         vector += new Vector3(0.18f, 0f, 0.05f);
                     }
                 }
                 if (flag)
                 {
                     vector.y -= 0.0390625f;
                 }
                 else
                 {
                     vector.y += 0.0390625f;
                 }
                 carriedThing.DrawAt(vector, flip);
             }
         }
         if (this.pawn.def.race.specialShadowData != null)
         {
             if (this.shadowGraphic == null)
             {
                 this.shadowGraphic = new Graphic_Shadow(this.pawn.def.race.specialShadowData);
             }
             this.shadowGraphic.Draw(drawLoc, Rot4.North, this.pawn, 0f);
         }
         if (this.graphics.nakedGraphic != null && this.graphics.nakedGraphic.ShadowGraphic != null)
         {
             this.graphics.nakedGraphic.ShadowGraphic.Draw(drawLoc, Rot4.North, this.pawn, 0f);
         }
     }
     else
     {
         Rot4         rot          = this.LayingFacing();
         Building_Bed building_Bed = this.pawn.CurrentBed();
         bool         renderBody;
         Quaternion   quat;
         Vector3      rootLoc;
         if (building_Bed != null && this.pawn.RaceProps.Humanlike)
         {
             renderBody = building_Bed.def.building.bed_showSleeperBody;
             Rot4 rotation = building_Bed.Rotation;
             rotation.AsInt += 2;
             quat            = rotation.AsQuat;
             AltitudeLayer altLayer = (AltitudeLayer)Mathf.Max((int)building_Bed.def.altitudeLayer, 15);
             Vector3       vector2  = this.pawn.Position.ToVector3ShiftedWithAltitude(altLayer);
             Vector3       vector3  = vector2;
             vector3.y += 0.02734375f;
             float   d = -this.BaseHeadOffsetAt(Rot4.South).z;
             Vector3 a = rotation.FacingCell.ToVector3();
             rootLoc    = vector2 + a * d;
             rootLoc.y += 0.0078125f;
         }
         else
         {
             renderBody = true;
             rootLoc    = drawLoc;
             if (!this.pawn.Dead && this.pawn.CarriedBy == null)
             {
                 rootLoc.y = Altitudes.AltitudeFor(AltitudeLayer.LayingPawn) + 0.0078125f;
             }
             if (this.pawn.Downed || this.pawn.Dead)
             {
                 quat = Quaternion.AngleAxis(this.wiggler.downedAngle, Vector3.up);
             }
             else if (this.pawn.RaceProps.Humanlike)
             {
                 quat = rot.AsQuat;
             }
             else
             {
                 Rot4 rot2 = Rot4.West;
                 int  num  = this.pawn.thingIDNumber % 2;
                 if (num != 0)
                 {
                     if (num == 1)
                     {
                         rot2 = Rot4.East;
                     }
                 }
                 else
                 {
                     rot2 = Rot4.West;
                 }
                 quat = rot2.AsQuat;
             }
         }
         this.RenderPawnInternal(rootLoc, quat, renderBody, rot, rot, bodyDrawType, false, headStump);
     }
     if (this.pawn.Spawned && !this.pawn.Dead)
     {
         this.pawn.stances.StanceTrackerDraw();
         this.pawn.pather.PatherDraw();
     }
     this.DrawDebug();
 }
Exemple #3
0
 public void RenderPawnAt(Vector3 drawLoc, RotDrawMode bodyDrawType, bool headStump, bool invisible)
 {
     if (!graphics.AllResolved)
     {
         graphics.ResolveAllGraphics();
     }
     if (pawn.GetPosture() == PawnPosture.Standing)
     {
         RenderPawnInternal(drawLoc, 0f, renderBody: true, bodyDrawType, headStump, invisible);
         if (pawn.carryTracker != null)
         {
             Thing carriedThing = pawn.carryTracker.CarriedThing;
             if (carriedThing != null)
             {
                 Vector3 drawPos = drawLoc;
                 bool    behind  = false;
                 bool    flip    = false;
                 if (pawn.CurJob == null || !pawn.jobs.curDriver.ModifyCarriedThingDrawPos(ref drawPos, ref behind, ref flip))
                 {
                     if (carriedThing is Pawn || carriedThing is Corpse)
                     {
                         drawPos += new Vector3(0.44f, 0f, 0f);
                     }
                     else
                     {
                         drawPos += new Vector3(0.18f, 0f, 0.05f);
                     }
                 }
                 if (behind)
                 {
                     drawPos.y -= 9f / 245f;
                 }
                 else
                 {
                     drawPos.y += 9f / 245f;
                 }
                 carriedThing.DrawAt(drawPos, flip);
             }
         }
         if (!invisible)
         {
             if (pawn.def.race.specialShadowData != null)
             {
                 if (shadowGraphic == null)
                 {
                     shadowGraphic = new Graphic_Shadow(pawn.def.race.specialShadowData);
                 }
                 shadowGraphic.Draw(drawLoc, Rot4.North, pawn);
             }
             if (graphics.nakedGraphic != null && graphics.nakedGraphic.ShadowGraphic != null)
             {
                 graphics.nakedGraphic.ShadowGraphic.Draw(drawLoc, Rot4.North, pawn);
             }
         }
     }
     else
     {
         float        angle        = BodyAngle();
         Rot4         rot          = LayingFacing();
         Building_Bed building_Bed = pawn.CurrentBed();
         bool         renderBody;
         Vector3      rootLoc;
         if (building_Bed != null && pawn.RaceProps.Humanlike)
         {
             renderBody = building_Bed.def.building.bed_showSleeperBody;
             AltitudeLayer altLayer = (AltitudeLayer)Mathf.Max((int)building_Bed.def.altitudeLayer, 17);
             Vector3       vector;
             Vector3       a = (vector = pawn.Position.ToVector3ShiftedWithAltitude(altLayer));
             vector.y += 6f / 245f;
             Rot4 rotation = building_Bed.Rotation;
             rotation.AsInt += 2;
             float   d  = 0f - BaseHeadOffsetAt(Rot4.South).z;
             Vector3 a2 = rotation.FacingCell.ToVector3();
             rootLoc    = a + a2 * d;
             rootLoc.y += 9f / 980f;
         }
         else
         {
             renderBody = true;
             rootLoc    = drawLoc;
             if (!pawn.Dead && pawn.CarriedBy == null)
             {
                 rootLoc.y = AltitudeLayer.LayingPawn.AltitudeFor() + 9f / 980f;
             }
         }
         RenderPawnInternal(rootLoc, angle, renderBody, rot, rot, bodyDrawType, portrait: false, headStump, invisible);
     }
     if (pawn.Spawned && !pawn.Dead)
     {
         pawn.stances.StanceTrackerDraw();
         pawn.pather.PatherDraw();
     }
     DrawDebug();
 }