예제 #1
0
        public override void Draw()
        {
            string mote = "OG_Mote_FlameGlow";

            if (this.def.projectile.damageDef == AdeptusDamageDefOf.OG_Chaos_Deamon_Warpfire)
            {
                mote = "OG_Mote_WarpFireGlow";
            }
            ThingDef moteDef = DefDatabase <ThingDef> .GetNamed(mote);

            Graphic glow  = moteDef.graphic;
            Mesh    mesh  = MeshPool.GridPlane(this.def.graphicData.drawSize * traveled);
            Mesh    mesh2 = MeshPool.GridPlane(moteDef.graphicData.drawSize * (traveled * 7));

            Graphics.DrawMesh(mesh, this.DrawPos, this.ExactRotation, Graphic.MatSingle, 0);
            Graphics.DrawMesh(mesh2, this.DrawPos, this.ExactRotation, glow.MatSingle, 0);

            /*
             *          Rand.PushState();
             *          Rand.Seed = this.thingIDNumber;
             *          for (int i = 0; i < 180; i++)
             *          {
             *
             *
             *  this.DrawPart(Rand.Range(0f, distancetraveled), Rand.Range(0f, 9f), Rand.Range(0.9f, 1.1f), Rand.Range(0.52f, 0.88f));
             *          }
             *          Rand.PopState();
             */
            base.Comps_PostDraw();
        }
예제 #2
0
        public override void Draw()
        {
            Vector3 position = MyPosition;

            position.y = def.altitudeLayer.AltitudeFor();

            if (IsFlying)
            {
                if (HasFlyingShadow)
                {
                    DrawFlyingShadow(DrawPos, ArcRatio);
                }
                else if (IsGroundShadowOnly)
                {
                    GroundShadowGraphic.Draw(position, Rot4.North, this);
                }
            }
            else if (IsGrounded)
            {
                if (HasGroundShadow)
                {
                    GroundShadowGraphic.Draw(position, Rot4.North, this);
                    //Log.Warning("ShadownMote Position:" + position + " - shadow layer:" + AltitudeLayer.Shadows.AltitudeFor());
                }
                else if (HasGroundShadowData)
                {
                    Log.Warning("should be drawing ground shadow, but not found");
                }
            }

            Graphics.DrawMesh(MeshPool.GridPlane(def.graphicData.drawSize), position, ExactRotation, def.DrawMatSingle, 0);
            //Comps_PostDraw();
        }
예제 #3
0
        // Token: 0x060052CD RID: 21197 RVA: 0x001BF0C4 File Offset: 0x001BD2C4
        public override void DrawAt(Vector3 drawLoc, bool flip = false)
        {
            float num = 0f;

            if (this.def.skyfaller.rotateGraphicTowardsDirection)
            {
                num = -this.angle;
            }
            if (this.def.skyfaller.angleCurve != null)
            {
                this.angle = this.def.skyfaller.angleCurve.Evaluate(this.TimeInAnimation);
            }
            if (this.def.skyfaller.rotationCurve != null)
            {
                num += this.def.skyfaller.rotationCurve.Evaluate(this.TimeInAnimation);
            }
            if (this.def.skyfaller.xPositionCurve != null)
            {
                drawLoc.x += this.def.skyfaller.xPositionCurve.Evaluate(this.TimeInAnimation);
            }
            if (this.def.skyfaller.zPositionCurve != null)
            {
                drawLoc.z += this.def.skyfaller.zPositionCurve.Evaluate(this.TimeInAnimation);
            }
            //	this.Graphic.Draw(drawLoc, flip ? this.Rotation.Opposite : this.Rotation, this, (base.Position.ToVector3Shifted() - drawLoc).ToAngleFlat());

            Graphics.DrawMesh(MeshPool.GridPlane(this.def.graphicData.drawSize), drawLoc, Quaternion.LookRotation((base.Position.ToVector3Shifted() - drawLoc).Yto0()), this.def.DrawMatSingle, 0);
        }
        public override void Draw()
        {
            if (spinCheck)
            {
                if (this.launcher is Pawn)
                {
                    Pawn pawn = this.launcher as Pawn;
                    if (pawn.equipment != null && pawn.equipment.Primary != null)
                    {
                        ThingWithComps weaponComp = pawn.equipment.Primary;
                        if (weaponComp.def.IsRangedWeapon)
                        {
                            shouldSpin = false;
                        }
                    }
                    spinCheck = false;
                }
            }
            if (shouldSpin)
            {
                this.rotationOffset += 49;
            }
            if (this.rotationOffset > 360)
            {
                this.rotationOffset = this.rotationOffset - 360;
            }
            Mesh mesh = MeshPool.GridPlane(this.def.graphicData.drawSize);

            Graphics.DrawMesh(mesh, DrawPos, Quaternion.AngleAxis(rotationOffset, Vector3.up) * ExactRotation, def.DrawMatSingle, 0);

            Comps_PostDraw();
        }
예제 #5
0
        public override void Draw()
        {
            Mesh mesh = MeshPool.GridPlane(this.def.graphicData.drawSize * traveled);

            Graphics.DrawMesh(mesh, this.DrawPos, this.ExactRotation, Graphic.MatSingle, 0);
            base.Comps_PostDraw();
        }
        public override void DrawWorker(Vector3 loc, Rot4 rot, ThingDef thingDef, Thing thing, float extraRotation)
        {
            if (baseData == null)
            {
                base.DrawWorker(loc, rot, thingDef, thing, extraRotation);
                return;
            }

            var useFrontBase = !thing.Rotation.IsHorizontal;
            var baseOffset   = new Vector3(baseData.baseOffset.x, 0, baseData.baseOffset.y - (thing.RotatedSize.z - 1) / 2f);
            var baseMat      = useFrontBase ? baseMatFront : baseMatSide;
            var baseMesh     = MeshPool.GridPlane(new Vector2(thing.RotatedSize.x, 1));

            Graphics.DrawMesh(baseMesh, loc + baseOffset, Quaternion.identity, baseMat, 0);

            var mesh     = MeshAt(rot);
            var rotation = QuatFromRot(rot);
            var material = MatAt(rot, thing);

            Graphics.DrawMesh(mesh, loc, rotation, material, 0);
            if (ShadowGraphic != null)
            {
                ShadowGraphic.DrawWorker(loc, rot, thingDef, thing, extraRotation);
            }
        }
예제 #7
0
        /// <summary>
        /// Draws projectile if at least a tick away from caster (or always if no caster)
        /// </summary>
        public override void Draw()
        {
            if (FlightTicks == 0 && launcher != null && launcher is Pawn)
            {
                //TODO: Draw at the end of the barrel on the pawn
            }
            else
            {
                //Projectile
                //Graphics.DrawMesh(MeshPool.plane10, DrawPos, DrawRotation, def.DrawMatSingle, 0);
                Graphics.DrawMesh(MeshPool.GridPlane(def.graphicData.drawSize), DrawPos, DrawRotation, def.DrawMatSingle, 0);

                //Shadow
                if (castShadow)
                {
                    //TODO : EXPERIMENTAL Add edifice height
                    var shadowPos = new Vector3(ExactPosition.x,
                                                def.Altitude - 0.01f,
                                                ExactPosition.z - Mathf.Lerp(shotHeight, 0f, fTicks / StartingTicksToImpact));
                    //EXPERIMENTAL: + (new CollisionVertical(ExactPosition.ToIntVec3().GetEdifice(Map))).Max);

                    //TODO : Vary ShadowMat plane
                    //Graphics.DrawMesh(MeshPool.plane08, shadowPos, ExactRotation, ShadowMaterial, 0);
                    Graphics.DrawMesh(MeshPool.GridPlane(def.graphicData.drawSize), shadowPos, ExactRotation, ShadowMaterial, 0);
                }

                Comps_PostDraw();
            }
        }
예제 #8
0
        public override void Draw()
        {
            Vector3 targetVector;

            if (parentPawn != null && parentPawn.stances != null && parentPawn.stances.curStance != null)
            {
                Stance_Busy stance_Busy = parentPawn.stances.curStance as Stance_Busy;
                if (stance_Busy != null)
                {
                    if (stance_Busy.focusTarg.HasThing)
                    {
                        targetVector = stance_Busy.focusTarg.Thing.DrawPos;
                    }
                    else
                    {
                        targetVector = stance_Busy.focusTarg.Cell.ToVector3Shifted();
                    }
                    if (swap)
                    {
                        currentGraphic = graphics[0];
                    }
                    else
                    {
                        currentGraphic = graphics[1];
                    }
                    currentGraphic.MatSingle.color = FireColor;
                    float angle = (targetVector - parent.TrueCenter()).AngleFlat();
                    Graphics.DrawMesh(MeshPool.GridPlane(new Vector2(2 - currentPower, 1)), parent.TrueCenter() + posFix + new Vector3(Mathf.Sin(angle * Mathf.Deg2Rad) * 1.1f, 1, Mathf.Cos(angle * Mathf.Deg2Rad)) * 1.1f, Quaternion.AngleAxis(angle, Vector3.up), currentGraphic.MatSingle, 0);
                }
            }
        }
예제 #9
0
        public override void Draw()
        {
            var rotat = Find.TickManager.TicksGame * 25f % 360;
            var mesh  = MeshPool.GridPlane(def.graphicData.drawSize);

            Graphics.DrawMesh(mesh, DrawPos, rotat.ToQuat(), def.DrawMatSingle, 0);
            Comps_PostDraw();
        }
예제 #10
0
        public override void Draw()
        {
            Mesh mesh  = MeshPool.GridPlane(this.def.graphicData.drawSize * traveled);
            Mesh mesh2 = MeshPool.GridPlane(DefDatabase <ThingDef> .GetNamed("Mote_FlameGlow").graphicData.drawSize *(traveled * 7));

            Graphics.DrawMesh(mesh, this.DrawPos, this.ExactRotation, Graphic.MatSingle, 0);
            Graphics.DrawMesh(mesh2, this.DrawPos, this.ExactRotation, DefDatabase <ThingDef> .GetNamed("Mote_FlameGlow").graphic.MatSingle, 0);
            base.Comps_PostDraw();
        }
예제 #11
0
 public override void Draw()
 {
     if (Props.drawGlow)
     {
         string motename = !Props.drawGlowMote.NullOrEmpty() ? Props.drawGlowMote : "Mote_FireGlow";
         Mesh   mesh2    = MeshPool.GridPlane(DefDatabase <ThingDef> .GetNamed(motename).graphicData.drawSize *(Drawsize * Props.drawGlowSizeFactor));
         Graphics.DrawMesh(mesh2, this.DrawPos, this.ExactRotation, DefDatabase <ThingDef> .GetNamed(motename).graphic.MatSingle, 0);
     }
     base.Draw();
 }
예제 #12
0
        public override void Draw()
        {
            Mesh mesh = MeshPool.GridPlane(this.def.graphicData.drawSize);

            //Graphics.DrawMesh(mesh, this.DrawPos, this.ExactRotation, this.def.DrawMatSingle, 0);
            base.Comps_PostDraw();

            Graphics.DrawMesh(mesh, this.DrawPos, this.ExactRotation, next_draw, 0);
            //Graphic.Draw(GenThing.TrueCenter(Position, ExactRotation, this.def.graphicData.drawSize, AltitudeLayer.MoteOverhead.AltitudeFor()), ExactRotation, 0f);
        }
예제 #13
0
        public override void Draw()
        {
            bool flag  = this.DefaultGraphic != null;
            bool flag2 = flag;

            if (flag2)
            {
                Graphics.DrawMesh(MeshPool.GridPlane(this.def.graphicData.drawSize), this.DrawPos, this.ExactRotation, this.Graphic.MatSingle, 0);
                this.DrawDropSpotShadow(ExactPosition);
            }
            base.Comps_PostDraw();
        }
예제 #14
0
        public override void Draw()
        {
            this.rotationOffset += Rand.Range(20, 36);
            if (this.rotationOffset > 360)
            {
                this.rotationOffset = 0;
            }
            Mesh mesh = MeshPool.GridPlane(this.def.graphicData.drawSize);

            Graphics.DrawMesh(mesh, DrawPos, (Quaternion.AngleAxis(rotationOffset, Vector3.up) * ExactRotation), def.DrawMatSingle, 0);
            Comps_PostDraw();
        }
예제 #15
0
        public override void PostDraw()
        {
            base.PostDraw();
            Vector3 drawPos = this.parent.DrawPos + Props.offset;

            if (graphic == null)
            {
                graphic = Props.graphicData.Graphic;
            }
            Mesh mesh2 = MeshPool.GridPlane(Graphic.drawSize * Props.graphicData.drawSize);

            Graphics.DrawMesh(mesh2, drawPos, Quaternion.AngleAxis(0, Vector3.up), Graphic.MatSingle, 0);
        }
예제 #16
0
        static void AlienRacesPatch(ref PawnRenderer __instance, Vector3 rootLoc, float angle, bool renderBody, Rot4 bodyFacing, Rot4 headFacing, out Mesh mesh, RotDrawMode bodyDrawType = RotDrawMode.Fresh, bool portrait = false, bool headStump = false)
        {
            mesh = null;
            Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>();

            AlienRace.ThingDef_AlienRace alienDef = pawn.def as AlienRace.ThingDef_AlienRace;
            if (alienDef != null)
            {
                Mesh mesh2;
                if (bodyDrawType == RotDrawMode.Rotting)
                {
                    if (__instance.graphics.dessicatedGraphic.ShouldDrawRotated)
                    {
                        mesh2 = MeshPool.GridPlane(portrait ? alienDef.alienRace.generalSettings.alienPartGenerator.customPortraitDrawSize : alienDef.alienRace.generalSettings.alienPartGenerator.customDrawSize);
                    }
                    else
                    {
                        Vector2 size = portrait ? alienDef.alienRace.generalSettings.alienPartGenerator.customPortraitDrawSize : alienDef.alienRace.generalSettings.alienPartGenerator.customDrawSize;
                        if (bodyFacing.IsHorizontal)
                        {
                            size = size.Rotated();
                        }
                        if (bodyFacing == Rot4.West && (__instance.graphics.dessicatedGraphic.data == null || __instance.graphics.dessicatedGraphic.data.allowFlip))
                        {
                            mesh = MeshPool.GridPlaneFlip(size);
                        }
                        mesh = MeshPool.GridPlane(size);
                    }
                }
                else
                {
                    AlienRace.AlienPartGenerator.AlienComp comp = pawn.TryGetComp <AlienRace.AlienPartGenerator.AlienComp>();
                    if (comp != null)
                    {
                        mesh = (portrait ? comp.alienPortraitGraphics.bodySet.MeshAt(bodyFacing) : comp.alienGraphics.bodySet.MeshAt(bodyFacing));
                    }
                }
            }
            else
            {
                if (pawn.RaceProps.Humanlike)
                {
                    mesh = MeshPool.humanlikeBodySet.MeshAt(bodyFacing);
                }
                else
                {
                    mesh = __instance.graphics.nakedGraphic.MeshAt(bodyFacing);
                }
            }
        }
예제 #17
0
        public override void Draw()
        {
            string mote = "Mote_FlameGlow";

            if (this.def.projectile.damageDef == AdeptusDamageDefOf.OG_Chaos_Deamon_Warpfire)
            {
                mote = "OG_Mote_WarpFireGlow";
            }
            Mesh mesh  = MeshPool.GridPlane(this.def.graphicData.drawSize * traveled);
            Mesh mesh2 = MeshPool.GridPlane(DefDatabase <ThingDef> .GetNamed(mote).graphicData.drawSize *(traveled * 5));

            Graphics.DrawMesh(mesh, this.DrawPos, this.ExactRotation, Graphic.MatSingle, 0);
            Graphics.DrawMesh(mesh2, this.DrawPos, this.ExactRotation, DefDatabase <ThingDef> .GetNamed(mote).graphic.MatSingle, 0);
            base.Comps_PostDraw();
        }
예제 #18
0
        public void DrawHands(float weaponAngle, Vector3 weaponPosition, CompWeaponExtensions compWeaponExtensions,
                              bool flipped)
        {
            Material handMat =
                GraphicDatabase.Get <Graphic_Single>("Overlays/Hand", ShaderDatabase.CutoutSkin, Vector2.one,
                                                     pawn.story.SkinColor).MatSingle;

            Mesh handsMesh = MeshPool.GridPlane(Vector2.one);

            if (compWeaponExtensions.FirstHandPosition != Vector3.zero)
            {
                Vector3 handPosition = compWeaponExtensions.FirstHandPosition;
                if (flipped)
                {
                    handPosition = -handPosition;
                    // keep z the same
                    handPosition.z = -handPosition.z;
                }

                Graphics.DrawMesh(handsMesh,
                                  weaponPosition + handPosition.RotatedBy(weaponAngle),
                                  Quaternion.AngleAxis(weaponAngle, Vector3.up), handMat, 0);
            }
            if (compWeaponExtensions.SecondHandPosition != Vector3.zero)
            {
                Vector3 handPosition = compWeaponExtensions.SecondHandPosition;
                if (flipped)
                {
                    handPosition = -handPosition;
                    // keep z the same
                    handPosition.z = -handPosition.z;
                }

                Graphics.DrawMesh(handsMesh,
                                  weaponPosition + handPosition.RotatedBy(weaponAngle),
                                  Quaternion.AngleAxis(weaponAngle, Vector3.up), handMat, 0);
            }

            //// for debug
            //var centerMat =
            //    GraphicDatabase.Get<Graphic_Single>("Overlays/Hand", ShaderDatabase.CutoutSkin, Vector2.one,
            //        Color.red).MatSingle;

            //Graphics.DrawMesh(handsMesh, weaponPosition + new Vector3(0, 0.001f, 0),
            //    Quaternion.AngleAxis(weaponAngle, Vector3.up), centerMat, 0);
        }
        public void Glow(Material mat, Vector3 pos, Quaternion ExactRotation)
        {
            Material glow = GlowMoteDef.graphic.MatSingle;

            if (useGraphicColor)
            {
                glow.color = mat.color;
            }
            else
            if (useGraphicColorTwo)
            {
                glow.SetColor(ShaderPropertyIDs.ColorTwo, mat.GetColorTwo());
            }
            Mesh mesh = MeshPool.GridPlane(GlowMoteDef.graphicData.drawSize * GlowMoteSize);

            Graphics.DrawMesh(mesh, pos, ExactRotation, glow, 0);
        }
예제 #20
0
        public override void Draw()
        {
            if (customxpath != "")
            {
                if (customimg == null)
                {
                    customimg = MaterialPool.MatFrom(this.customxpath);
                }

                Mesh mesh = MeshPool.GridPlane(this.def.graphicData.drawSize);

                Graphics.DrawMesh(mesh, this.DrawPos, Quaternion.identity, customimg, 0);
            }
            else
            {
                base.Draw();
            }
        }
예제 #21
0
        // Token: 0x06001651 RID: 5713 RVA: 0x00081EDC File Offset: 0x000800DC
        public override void Draw()
        {
            float   num     = this.ArcHeightFactor * GenMath.InverseParabola(this.DistanceCoveredFraction);
            Vector3 drawPos = this.DrawPos;

            Vector3 position = drawPos + new Vector3(0f, 0f, 1f) * num;

            if (this.ticksToImpact > 0 && !Find.TickManager.Paused)
            {
                this.rotinc += rotrate;
            }
            if (this.def.projectile.shadowSize > 0f)
            {
                this.DrawShadow(drawPos, num);
            }
            Graphics.DrawMesh(MeshPool.GridPlane(this.def.graphicData.drawSize), position, this.ExactRotation, this.Graphic.MatSingleFor(this), 0);
            base.Comps_PostDraw();
        }
        public override void Draw()
        {
            float   num      = ArcHeightFactor * GenMath.InverseParabola(DistanceCoveredFraction);
            Vector3 drawPos  = DrawPos;
            Vector3 position = drawPos + new Vector3(0f, 0f, 1f) * num;

            if (def.projectile.shadowSize > 0f)
            {
                DrawShadow(drawPos, num);
            }
            if (onGround)
            {
                Graphics.DrawMesh(MeshPool.GridPlane(def.graphicData.drawSize), position, ExactRotation, groundMat, 0);
            }
            else
            {
                Graphics.DrawMesh(MeshPool.GridPlane(def.graphicData.drawSize), position, ExactRotation, def.DrawMatSingle, 0);
            }
            Comps_PostDraw();
        }
        public void Glow(Thing glower, Quaternion ExactRotation)
        {
            if (glowGrahphicData == null)
            {
                Material material = GlowMoteDef.graphic.MatSingle;
                if (useGraphicColor)
                {
                    material.color = glower.DrawColor;
                }
                else
                if (useGraphicColorTwo)
                {
                    material.color = glower.DrawColorTwo;
                }

                Mesh mesh2 = MeshPool.GridPlane(GlowMoteDef.graphicData.drawSize * GlowMoteSize);
                Graphics.DrawMesh(mesh2, glower.DrawPos, ExactRotation, material, 0);
            }
            else
            {
                if (_glowGrahphic == null)
                {
                    _glowGrahphic = glowGrahphicData.GraphicColoredFor(glower);
                }
                if (useGraphicColor)
                {
                    _glowGrahphic.color = glower.DrawColor;
                }
                else
                if (useGraphicColorTwo)
                {
                    _glowGrahphic.color = glower.DrawColorTwo;
                }

                Mesh mesh2 = MeshPool.GridPlane(glower.Graphic.drawSize * glowGrahphicData.drawSize);
                Graphics.DrawMesh(mesh2, glower.DrawPos, ExactRotation, _glowGrahphic.MatSingle, 0);
            }
        }
예제 #24
0
 public override void Draw()
 {
     Graphics.DrawMesh(MeshPool.GridPlane(projectileDef.graphicData.drawSize), DrawPos, ExactRotation, projectileDef.DrawMatSingle, 0);
 }
예제 #25
0
 public override Mesh MeshAt(Rot4 rot)
 {
     return(MeshPool.GridPlane(data.drawSize));
 }
예제 #26
0
        public virtual Mesh MeshAt(Rot4 rot)
        {
            Vector2 vector2 = this.drawSize;

            if (rot.IsHorizontal && !this.ShouldDrawRotated)
            {
                vector2 = vector2.Rotated();
            }
            return(rot == Rot4.West && this.WestFlipped || rot == Rot4.East && this.EastFlipped ? MeshPool.GridPlaneFlip(vector2) : MeshPool.GridPlane(vector2));
        }
예제 #27
0
        private static void RenderPawnInternal(PawnRenderer __instance, Vector3 rootLoc, Quaternion quat, bool renderBody, Rot4 bodyFacing, Rot4 headFacing, RotDrawMode bodyDrawType = RotDrawMode.Fresh, bool portrait = false)
        {
            Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>();

            if (!pawn.def.race.Humanlike)
            {
                return;
            }

            Corruption.CompPsyker         compPsyker     = pawn.TryGetComp <CompPsyker>();
            List <HediffComp_DrawImplant> implantDrawers = HarmonyPatches.implantDrawers(pawn);
            string patronName = "Emperor";
            bool   drawChaos  = false;

            if (compPsyker != null)
            {
                patronName = compPsyker.patronName;
                //        Log.Message("GettingComp: " + patronName);
                if (patronName == "Khorne" || patronName == "Nurgle" || patronName == "Tzeentch" || patronName == "Undivided")
                {
                    //            Log.Message("drawChaos");
                    drawChaos = true;
                }
            }

            if (!__instance.graphics.AllResolved)
            {
                __instance.graphics.ResolveAllGraphics();
            }
            Mesh mesh = null;

            if (renderBody)
            {
                Vector3 loc = rootLoc;
                loc.y += 0.005f;
                if (bodyDrawType == RotDrawMode.Dessicated && !pawn.RaceProps.Humanlike && __instance.graphics.dessicatedGraphic != null && !portrait)
                {
                    __instance.graphics.dessicatedGraphic.Draw(loc, bodyFacing, pawn);
                }
                else
                {
                    ThingDef_AlienRace alienDef = pawn.def as ThingDef_AlienRace;
                    if (alienDef != null)
                    {
                        Mesh mesh2;
                        if (bodyDrawType == RotDrawMode.Rotting)
                        {
                            if (__instance.graphics.dessicatedGraphic.ShouldDrawRotated)
                            {
                                mesh2 = MeshPool.GridPlane(portrait ? alienDef.alienRace.generalSettings.alienPartGenerator.CustomPortraitDrawSize : alienDef.alienRace.generalSettings.alienPartGenerator.CustomDrawSize);
                            }
                            else
                            {
                                Vector2 size = portrait ? alienDef.alienRace.generalSettings.alienPartGenerator.CustomPortraitDrawSize : alienDef.alienRace.generalSettings.alienPartGenerator.CustomDrawSize;
                                if (bodyFacing.IsHorizontal)
                                {
                                    size = size.Rotated();
                                }
                                if (bodyFacing == Rot4.West && (__instance.graphics.dessicatedGraphic.data == null || __instance.graphics.dessicatedGraphic.data.allowFlip))
                                {
                                    mesh = MeshPool.GridPlaneFlip(size);
                                }
                                mesh = MeshPool.GridPlane(size);
                            }
                        }
                        else
                        {
                            mesh = (portrait ? alienDef.alienRace.generalSettings.alienPartGenerator.bodyPortraitSet.MeshAt(bodyFacing) : alienDef.alienRace.generalSettings.alienPartGenerator.bodySet.MeshAt(bodyFacing));
                        }
                    }
                    else
                    {
                        if (pawn.RaceProps.Humanlike)
                        {
                            mesh = MeshPool.humanlikeBodySet.MeshAt(bodyFacing);
                        }
                        else
                        {
                            mesh = __instance.graphics.nakedGraphic.MeshAt(bodyFacing);
                        }
                    }
                    List <Material> list = __instance.graphics.MatsBodyBaseAt(bodyFacing, bodyDrawType);
                    for (int i = 0; i < list.Count; i++)
                    {
                        //               Material damagedMat = __instance.graphics.flasher.GetDamagedMat(list[i]);
                        //               GenDraw.DrawMeshNowOrLater(mesh, loc, quat, damagedMat, portrait);
                        loc.y += 0.005f;
                        if (i == 0)
                        {
                            if (drawChaos)
                            {
                                Material markMat = (Corruption.AfflictionDrawerUtility.GetBodyOverlay(pawn.story.bodyType, patronName).MatAt(bodyFacing));
                                if (pawn.ageTracker.CurLifeStageIndex == 2 && pawn.RaceProps.Humanlike)
                                {
                                    markMat.mainTextureScale  = new Vector2(1, 1.3f);
                                    markMat.mainTextureOffset = new Vector2(0, -0.2f);
                                    if (bodyFacing == Rot4.West || bodyFacing == Rot4.East)
                                    {
                                        markMat.mainTextureOffset = new Vector2(-0.015f, -0.2f);
                                    }
                                }
                                GenDraw.DrawMeshNowOrLater(mesh, loc, quat, markMat, portrait);
                                loc.y += 0.005f;
                            }
                        }

                        if (bodyDrawType == RotDrawMode.Fresh)
                        {
                            Vector3 drawLoc = rootLoc;
                            drawLoc.y += 0.02f;
                            //                    Traverse.Create(__instance).Field("woundOverlays").GetValue<PawnWoundDrawer>().RenderOverBody(drawLoc, mesh, quat, portrait);
                        }
                    }
                }
                Vector3 vector = rootLoc;
                Vector3 a      = rootLoc;
                if (bodyFacing != Rot4.North)
                {
                    a.y      += 0.03f;
                    vector.y += 0.0249999985f;
                }
                else
                {
                    a.y      += 0.0249999985f;
                    vector.y += 0.03f;
                }
                if (__instance.graphics.headGraphic != null)
                {
                    Vector3  b     = quat * __instance.BaseHeadOffsetAt(headFacing);
                    Mesh     mesh2 = MeshPool.humanlikeHeadSet.MeshAt(headFacing);
                    Material mat   = __instance.graphics.HeadMatAt(headFacing, bodyDrawType);
                    //            GenDraw.DrawMeshNowOrLater(mesh2, a + b, quat, mat, portrait);
                    if (drawChaos)
                    {
                        Material headMarkMat = (AfflictionDrawerUtility.GetHeadGraphic(pawn, patronName).MatAt(bodyFacing));
                        //   vector.y += 0.005f;
                        GenDraw.DrawMeshNowOrLater(mesh2, a + b + new Vector3(0f, 0.004f, 0f), quat, headMarkMat, portrait);
                    }

                    Vector3 loc2 = rootLoc + b;
                    loc2.y += 0.035f;
                    bool flag  = false;
                    Mesh mesh3 = __instance.graphics.HairMeshSet.MeshAt(headFacing);
                    List <ApparelGraphicRecord> apparelGraphics = __instance.graphics.apparelGraphics;
                    for (int j = 0; j < apparelGraphics.Count; j++)
                    {
                        if (apparelGraphics[j].sourceApparel.def.apparel.LastLayer == ApparelLayer.Overhead)
                        {
                            flag = true;
                            Material material = apparelGraphics[j].graphic.MatAt(bodyFacing, null);
                            material = __instance.graphics.flasher.GetDamagedMat(material);
                            //               GenDraw.DrawMeshNowOrLater(mesh3, loc2, quat, material, portrait);
                        }

                        if (!flag && bodyDrawType != RotDrawMode.Dessicated)
                        {
                            Mesh     mesh4 = __instance.graphics.HairMeshSet.MeshAt(headFacing);
                            Material mat2  = __instance.graphics.HairMatAt(headFacing);
                            //                   GenDraw.DrawMeshNowOrLater(mesh4, loc2, quat, mat2, portrait);
                        }
                    }
                    if (renderBody)
                    {
                        for (int k = 0; k < __instance.graphics.apparelGraphics.Count; k++)
                        {
                            Material pauldronMat;
                            if (CompPauldronDrawer.ShouldDrawPauldron(pawn, __instance.graphics.apparelGraphics[k].sourceApparel, bodyFacing, out pauldronMat))
                            {
                                if (pawn.ageTracker.CurLifeStageIndex == 2)
                                {
                                    pauldronMat.mainTextureScale  = new Vector2(1.00f, 1.22f);
                                    pauldronMat.mainTextureOffset = new Vector2(0, -0.1f);
                                }
                                vector.y += 0.035f;
                                GenDraw.DrawMeshNowOrLater(mesh, vector, quat, pauldronMat, portrait);
                            }
                            ApparelGraphicRecord apparelGraphicRecord = __instance.graphics.apparelGraphics[k];
                            if (apparelGraphicRecord.sourceApparel.def.apparel.LastLayer == ApparelLayer.Shell)
                            {
                                //           Material material2 = apparelGraphicRecord.graphic.MatAt(bodyFacing, null);
                                //           material2 = __instance.graphics.flasher.GetDamagedMat(material2);
                                //           GenDraw.DrawMeshNowOrLater(mesh, vector, quat, material2, portrait);
                            }
                            if (!pawn.Dead)
                            {
                                for (int l = 0; l < pawn.health.hediffSet.hediffs.Count; l++)
                                {
                                    HediffComp_DrawImplant drawer;
                                    if ((drawer = pawn.health.hediffSet.hediffs[l].TryGetComp <HediffComp_DrawImplant>()) != null)
                                    {
                                        if (drawer.implantDrawProps.implantDrawerType != ImplantDrawerType.Head)
                                        {
                                            vector.y += 0.005f;
                                            if (bodyFacing == Rot4.South && drawer.implantDrawProps.implantDrawerType == ImplantDrawerType.Backpack)
                                            {
                                                vector.y -= 0.3f;
                                            }
                                            Material implantMat = drawer.ImplantMaterial(pawn, bodyFacing);
                                            GenDraw.DrawMeshNowOrLater(mesh, vector, quat, implantMat, portrait);
                                            vector.y += 0.005f;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #28
0
        // draws hands on equipment and adjusts aiming angle position, if corresponding Comp is specified
        public new void DrawEquipmentAiming(Thing equipment, Vector3 weaponDrawLoc, float aimAngle)
        {
            CompWeaponExtensions compWeaponExtensions = pawn.equipment.Primary.TryGetComp <CompWeaponExtensions>();

            float   weaponAngle;
            Vector3 weaponPositionOffset = Vector3.zero;

            Mesh weaponMesh;
            bool flipped;
            bool aiming = Aiming();

            if (aimAngle > 110 && aimAngle < 250)
            {
                flipped = true;

                // flip weapon texture
                weaponMesh = MeshPool.GridPlaneFlip(equipment.Graphic.drawSize);

                if (!aiming && compWeaponExtensions != null)
                {
                    weaponPositionOffset += compWeaponExtensions.WeaponPositionOffset;
                    // flip x position offset
                    weaponPositionOffset.x = -weaponPositionOffset.x;
                }

                weaponAngle  = aimAngle - 180f;
                weaponAngle -= !aiming
                    ? equipment.def.equippedAngleOffset
                    : (compWeaponExtensions?.AttackAngleOffset ?? 0);
            }
            else
            {
                flipped = false;

                weaponMesh = MeshPool.GridPlane(equipment.Graphic.drawSize);

                if (!aiming && compWeaponExtensions != null)
                {
                    weaponPositionOffset += compWeaponExtensions.WeaponPositionOffset;
                }

                weaponAngle  = aimAngle;
                weaponAngle += !aiming
                    ? equipment.def.equippedAngleOffset
                    : (compWeaponExtensions?.AttackAngleOffset ?? 0);
            }

            if (pawn.Rotation == Rot4.West || pawn.Rotation == Rot4.North)
            {
                // draw weapon beneath the pawn
                weaponPositionOffset += new Vector3(0, -0.5f, 0);
            }

            // weapon angle and position offsets based on current attack animation sequence
            DoAttackAnimationOffsets(ref weaponAngle, ref weaponPositionOffset, flipped);

            Graphic_StackCount graphic_StackCount = equipment.Graphic as Graphic_StackCount;
            Material           weaponMat          = graphic_StackCount != null
                ? graphic_StackCount.SubGraphicForStackCount(1, equipment.def).MatSingle
                : equipment.Graphic.MatSingle;

            // draw weapon
            Graphics.DrawMesh(weaponMesh, weaponDrawLoc + weaponPositionOffset,
                              Quaternion.AngleAxis(weaponAngle, Vector3.up),
                              weaponMat, 0);

            // draw hands on equipment, if CompWeaponExtensions defines them
            if (compWeaponExtensions != null)
            {
                DrawHands(weaponAngle, weaponDrawLoc + weaponPositionOffset, compWeaponExtensions, flipped);
            }
        }