public static float AltitudeFor(AltitudeLayer alt) { return(Altitudes.Alts[(uint)alt]); }
public static void DrawGhostThing(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude, Thing thing = null) { DrawGhostThing_NewTmp(center, rot, thingDef, baseGraphic, ghostCol, drawAltitude, thing); }
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)) { vector = ((!(carriedThing is Pawn) && !(carriedThing is Corpse)) ? (vector + new Vector3(0.18f, 0f, 0.05f)) : (vector + new Vector3(0.44f, 0f, 0f))); } 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; Vector3 vector4 = this.BaseHeadOffsetAt(Rot4.South); float d = (float)(0.0 - vector4.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 = (float)(Altitudes.AltitudeFor(AltitudeLayer.LayingPawn) + 0.0078125); } 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; switch (this.pawn.thingIDNumber % 2) { case 0: rot2 = Rot4.West; break; case 1: rot2 = Rot4.East; break; } 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(); }
public TM_WeatherEvent_MeshGeneric(Map map, Material meshMat, Vector3 meshStart, Vector3 meshEnd, float meshContortionMagnitude, AltitudeLayer altitudeLayer, int durationSolid, int fadeOutTicks, int fadeInTicks) : base(map) { this.map = map; this.meshMat = meshMat; this.meshStart = meshStart; this.meshEnd = meshEnd; this.meshContortionMagnitude = meshContortionMagnitude; this.altitudeLayer = altitudeLayer; this.durationSolid = durationSolid; this.fadeOutTicks = fadeOutTicks; this.fadeInTicks = fadeInTicks; //this.shadowVector = new Vector2(Rand.Range(-5f, 5f), Rand.Range(-5f, 0f)); }
public static void DrawGhostThing_NewTmp(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude, Thing thing = null, bool drawPlaceWorkers = true) { if (baseGraphic == null) { baseGraphic = thingDef.graphic; } Graphic graphic = GhostUtility.GhostGraphicFor(baseGraphic, thingDef, ghostCol); Vector3 loc = GenThing.TrueCenter(center, rot, thingDef.Size, drawAltitude.AltitudeFor()); graphic.DrawFromDef(loc, rot, thingDef); for (int i = 0; i < thingDef.comps.Count; i++) { thingDef.comps[i].DrawGhost(center, rot, thingDef, ghostCol, drawAltitude, thing); } if (drawPlaceWorkers && thingDef.PlaceWorkers != null) { for (int j = 0; j < thingDef.PlaceWorkers.Count; j++) { thingDef.PlaceWorkers[j].DrawGhost(thingDef, center, rot, ghostCol, thing); } } }
// Verse.GhostDrawer public static bool HeronDoorGhostHandler(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude) { if (thingDef is DoorExpandedDef def && def.fixedPerspective) { //Log.Message("1"); Graphic graphic = (Graphic)AccessTools.Method(typeof(GhostDrawer), "GhostGraphicFor").Invoke(null, new object[] { thingDef.graphic, thingDef, ghostCol }); //Log.Message("2"); Vector3 loc = Gen.TrueCenter(center, rot, thingDef.Size, Altitudes.AltitudeFor(drawAltitude)); for (int i = 0; i < 2; i++) { bool flipped = (i != 0) ? true : false; Mesh mesh; Matrix4x4 matrix; Building_DoorExpanded.DrawParams(def, loc, rot, out mesh, out matrix, 0, flipped); Graphics.DrawMesh(mesh, matrix, graphic.MatAt(rot, null), 0); } if (thingDef.PlaceWorkers != null) { for (int i = 0; i < thingDef.PlaceWorkers.Count; i++) { thingDef.PlaceWorkers[i].DrawGhost(thingDef, center, rot); } } return(false); } return(true); }
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(); }
public override void DrawGhost(IntVec3 center, Rot4 rot, ThingDef thingDef, Color ghostCol, AltitudeLayer drawAltitude, Thing thing = null) { base.DrawGhost(center, rot, thingDef, ghostCol, drawAltitude, thing); var list = CellsWithinRange(center).ToList(); GenDraw.DrawFieldEdges(list, this.ghostColor); }
public Vector3 ToVector3ShiftedWithAltitude(AltitudeLayer AltLayer) { return(ToVector3ShiftedWithAltitude(Altitudes.AltitudeFor(AltLayer))); }
public virtual void DrawGhost(IntVec3 center, Rot4 rot, ThingDef thingDef, Color ghostCol, AltitudeLayer drawAltitude) { }
public Vector3 ToVector3ShiftedWithAltitude(AltitudeLayer AltLayer) { return(this.ToVector3ShiftedWithAltitude(AltLayer.AltitudeFor())); }
public void DrawOverlays(string PatronName, Pawn corrpawn) { bodyMesh = MeshPool.humanlikeBodySet.MeshAt(corrpawn.Rotation); headMesh = MeshPool.humanlikeHeadSet.MeshAt(corrpawn.Rotation); if (corrpawn.story == null) { btype = BodyType.Undefined; } else { btype = corrpawn.story.BodyType; } HeadGraphic = GetHeadGraphic(corrpawn, PatronName); BodyGraphic = GetBodyOverlay(btype, PatronName); bodydrawpos = corrpawn.Drawer.DrawPos; headvec = corrpawn.Drawer.renderer.BaseHeadOffsetAt(corrpawn.Rotation); headdrawpos = bodydrawpos + headvec; headMat = HeadGraphic.MatAt(corrpawn.Rotation); bodyMat = BodyGraphic.MatAt(corrpawn.Rotation); if (corrpawn.Rotation == Rot4.North) { headMesh = MeshPool.plane03; bodyMesh = MeshPool.humanlikeBodySet.MeshAt(corrpawn.Rotation); } else { headMesh = MeshPool.humanlikeBodySet.MeshAt(corrpawn.Rotation); bodyMesh = MeshPool.humanlikeBodySet.MeshAt(corrpawn.Rotation); } bodydrawpos.y += 0.0019f; if (corrpawn.Rotation == Rot4.North) { headdrawpos.y += 0.0f; } else { headdrawpos.y += 0.051f; } if (corrpawn.Downed || corrpawn.Dead) { headMat = HeadGraphic.MatAt(LayingFacingDet(corrpawn)); bodyMat = BodyGraphic.MatAt(LayingFacingDet(corrpawn)); if (corrpawn.Dead) { num = corrpawn.corpse.innerPawn.Drawer.renderer.wiggler.downedAngle; } else { num = corrpawn.Drawer.renderer.wiggler.downedAngle; } if (corrpawn.thingIDNumber % 4 == 3) { headMesh = MeshPool.plane10Flip; } quat = Quaternion.AngleAxis(num, Vector3.up); Vector3 newPos = quat * headvec; headdrawpos = corrpawn.Drawer.DrawPos + newPos; bodydrawpos = corrpawn.Drawer.DrawPos; bodydrawpos.y = Altitudes.AltitudeFor(AltitudeLayer.LayingPawn) + 0.001f; if (corrpawn.Dead) { if (corrpawn.Drawer != null && corrpawn.corpse != null) { Vector3 headvecD = corrpawn.Drawer.renderer.BaseHeadOffsetAt(corrpawn.corpse.Rotation); Vector3 newPosD = quat * headvecD; headdrawpos = corrpawn.corpse.DrawPos + newPosD; } quat = Quaternion.AngleAxis(num, Vector3.up); bodydrawpos = corrpawn.corpse.DrawPos; bodydrawpos.y -= 0.05f; } } if (corrpawn.CarriedBy != null) { Pawn pepe = corrpawn.CarriedBy; Vector3 vec = corrpawn.CarriedBy.DrawPos; Vector3 newPos = quat * headvec; vec.x += 0.5f; bodydrawpos = vec; headdrawpos = bodydrawpos + newPos; } Building_Bed bbed = corrpawn.CurrentBed(); if (bbed != null && corrpawn.RaceProps.Humanlike) { RenderBody = false; Rot4 rotation = bbed.Rotation; num = bbed.Rotation.AsAngle; AltitudeLayer altLayer = (AltitudeLayer)Mathf.Max((int)bbed.def.altitudeLayer, 15); Vector3 a = this.cpawn.Position.ToVector3ShiftedWithAltitude(altLayer); float d = -this.cpawn.Drawer.renderer.BaseHeadOffsetAt(Rot4.South).z; Vector3 a2 = rotation.FacingCell.ToVector3(); headdrawpos = a + a2 * d; headdrawpos.y += 0.01f; headMat = HeadGraphic.MatAt(LayingFacingDet(corrpawn)); } Vector3 s = new Vector3(1.0f, 1.0f, 1.0f); Matrix4x4 matrixHead = default(Matrix4x4); Matrix4x4 matrixBody = default(Matrix4x4); matrixHead.SetTRS(headdrawpos, Quaternion.AngleAxis(num, Vector3.up), s); matrixBody.SetTRS(bodydrawpos, Quaternion.AngleAxis(num, Vector3.up), s); Graphics.DrawMesh(headMesh, headdrawpos, Quaternion.AngleAxis(num, Vector3.up), headMat, 45); if (RenderBody) { Graphics.DrawMesh(bodyMesh, bodydrawpos, Quaternion.AngleAxis(num, Vector3.up), bodyMat, 40); } PortraitsCache.SetDirty(corrpawn); }
public static void DrawGhostThing_NewTmp(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude, Thing thing = null, bool drawPlaceWorkers = true) { if (baseGraphic == null) { baseGraphic = thingDef.graphic; } Graphic graphic = baseGraphic; Vector3 loc = GenThing.TrueCenter(center, rot, thingDef.Size, drawAltitude.AltitudeFor()); DrawShadow(graphic, loc, rot, thingDef); }
public static void DrawGhostVehicle(IntVec3 center, Rot8 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude, Thing thing = null) { if (thingDef is VehicleBuildDef def) { VehicleDef vehicleDef = def.thingToSpawn; if (vehicleDef.GetSortedCompProperties <CompProperties_Cannons>() is CompProperties_Cannons props) { Vector3 loc = GenThing.TrueCenter(center, rot, def.Size, drawAltitude.AltitudeFor()); vehicleDef.DrawGhostCannonTextures(loc, rot, ghostCol); } } }
// Token: 0x06000241 RID: 577 RVA: 0x000145E4 File Offset: 0x000127E4 public override void DrawWornExtras() { if (base.Wearer == null || !base.Wearer.Spawned) { return; } Building_Bed building_Bed = base.Wearer.CurrentBed(); if (building_Bed != null && !building_Bed.def.building.bed_showSleeperBody && !this.onHead) { return; } if (this.onHead) { Log.ErrorOnce("Adeptus Mechanicus :: Apparel_VisibleAccessory: The head drawing code is incomplete and the apparel '" + this.Label + "' will not be drawn.", (int)this.def.debugRandomId, false); return; } Rot4 rot = default(Rot4); float angle = 0f; Vector3 vector = base.Wearer.Drawer.DrawPos; Rot4 rot2; if (base.Wearer.GetPosture() != PawnPosture.Standing) { rot2 = this.LayingFacing(); if (building_Bed != null) { rot = building_Bed.Rotation; rot.AsInt += 2; angle = rot.AsAngle; AltitudeLayer altLayer = (AltitudeLayer)Mathf.Max((int)building_Bed.def.altitudeLayer, 14); vector.y = base.Wearer.Position.ToVector3ShiftedWithAltitude(altLayer).y; vector += rot.FacingCell.ToVector3() * -base.Wearer.Drawer.renderer.BaseHeadOffsetAt(Rot4.South).z; } else { vector.y = base.Wearer.Position.ToVector3ShiftedWithAltitude(AltitudeLayer.LayingPawn).y; if (base.Wearer.Downed) { float?num = (((((base.Wearer.Drawer == null) ? null : base.Wearer.Drawer.renderer) == null) ? null : base.Wearer.Drawer.renderer.wiggler) == null) ? null : new float?(base.Wearer.Drawer.renderer.wiggler.downedAngle); if (num != null) { angle = num.Value; } } else { angle = rot2.FacingCell.AngleFlat; } } vector.y += 0.005f; } else { rot2 = base.Wearer.Rotation; vector.y = base.Wearer.Position.ToVector3ShiftedWithAltitude(AltitudeLayer.Pawn).y; } vector.y += this.GetAltitudeOffset(rot2); Graphic graphic = GraphicDatabase.Get <Graphic_Multi>(this.def.graphicData.texPath + "_" + ((base.Wearer == null) ? null : base.Wearer.story.bodyType.ToString()), ShaderDatabase.CutoutComplex, this.def.graphicData.drawSize, this.DrawColor); Material material = new ApparelGraphicRecord(graphic, this).graphic.MatAt(rot2, null); Vector3 s = new Vector3(1.5f, 1.5f, 1.5f); Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(vector, Quaternion.AngleAxis(angle, Vector3.up), s); // Graphics.DrawMesh((rot2 == Rot4.West) ? MeshPool.plane10Flip : MeshPool.plane10, matrix, material, 0); CompPauldronDrawer comp = base.GetComp <CompPauldronDrawer>(); if (comp != null) { // comp.PostDraw_Pads(vector, rot2); } base.DrawWornExtras(); }
public static void DrawGhostThing(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude) { if (baseGraphic == null) { baseGraphic = thingDef.graphic; } Graphic graphic = GhostDrawer.GhostGraphicFor(baseGraphic, thingDef, ghostCol); Vector3 loc = Gen.TrueCenter(center, rot, thingDef.Size, Altitudes.AltitudeFor(drawAltitude)); graphic.DrawFromDef(loc, rot, thingDef, 0f); if (thingDef.PlaceWorkers != null) { for (int i = 0; i < thingDef.PlaceWorkers.Count; i++) { thingDef.PlaceWorkers[i].DrawGhost(thingDef, center, rot); } } }
public override void DrawWornExtras() { if (Wearer == null || !Wearer.Spawned) { return; } Building_Bed bed = Wearer.CurrentBed(); if (bed != null && !bed.def.building.bed_showSleeperBody && !onHead) { return; } //Since I haven't a head apparel item to test the drawing code against for now we throw an error (ONCE) and exit. if (this.onHead) { Log.ErrorOnce(string.Concat("Combat Extended :: Apparel_VisibleAccessory: The head drawing code is incomplete and the apparel '", this.Label, "' will not be drawn."), this.def.debugRandomId); return; } // compute drawVec, angle and Rot4 vars Rot4 rotation; Rot4 bedRotation = new Rot4(); float angle = 0; Vector3 drawVec = Wearer.Drawer.DrawPos; if (Wearer.GetPosture() != PawnPosture.Standing) { rotation = LayingFacing(); if (bed != null) { bedRotation = bed.Rotation; bedRotation.AsInt += 2; angle = bedRotation.AsAngle; AltitudeLayer altitude = (AltitudeLayer)((byte)Mathf.Max((int)bed.def.altitudeLayer, 14)); drawVec.y = Wearer.Position.ToVector3ShiftedWithAltitude(altitude).y; drawVec += bedRotation.FacingCell.ToVector3() * (-Wearer.Drawer.renderer.BaseHeadOffsetAt(Rot4.South).z); } else { drawVec.y = Wearer.Position.ToVector3ShiftedWithAltitude(AltitudeLayer.LayingPawn).y; if (Wearer.Downed) // Wearer.Spawned == false when Pawn.Dead == true. { float?newAngle = (((((Wearer.Drawer == null) ? null : Wearer.Drawer.renderer) == null) ? null : Wearer.Drawer.renderer.wiggler) == null) ? (float?)null : Wearer.Drawer.renderer.wiggler.downedAngle; if (newAngle != null) { angle = newAngle.Value; } } else { angle = rotation.FacingCell.AngleFlat; } } drawVec.y += 0.005f; } else { rotation = Wearer.Rotation; drawVec.y = Wearer.Position.ToVector3ShiftedWithAltitude(AltitudeLayer.Pawn).y; } drawVec.y += GetAltitudeOffset(rotation); // Get the graphic path string path = def.graphicData.texPath + "_" + ((Wearer == null) ? null : Wearer.story.bodyType.ToString()); Graphic graphic = GraphicDatabase.Get <Graphic_Multi>(path, ShaderDatabase.CutoutComplex, def.graphicData.drawSize, DrawColor); ApparelGraphicRecord apparelGraphic = new ApparelGraphicRecord(graphic, this); Material mat = apparelGraphic.graphic.MatAt(rotation); Vector3 s = new Vector3(1.5f, 1.5f, 1.5f); //mat.shader = ShaderDatabase.CutoutComplex; //mat.color = DrawColor; Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(drawVec, Quaternion.AngleAxis(angle, Vector3.up), s); Graphics.DrawMesh(rotation == Rot4.West ? MeshPool.plane10Flip : MeshPool.plane10, matrix, mat, 0); }
public override void DrawGhost(IntVec3 center, Rot4 rot, ThingDef thingDef, Color ghostCol, AltitudeLayer drawAltitude) { Graphic graphic = GhostUtility.GhostGraphicFor(CompFireOverlay.FireGraphic, thingDef, ghostCol); graphic.DrawFromDef(center.ToVector3ShiftedWithAltitude(drawAltitude), rot, thingDef, 0f); }
public void RenderPawnAt(Vector3 drawLoc, RotDrawMode bodyDrawType, bool headStump, bool invisible, int curLevel, int baseLevel) { if (!this.graphics.AllResolved) { this.graphics.ResolveAllGraphics(); } if (this.pawn.GetPosture() == PawnPosture.Standing) { this.RenderPawnInternal(drawLoc, 0f, true, bodyDrawType, headStump, invisible, curLevel, baseLevel); 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.03787879f; } else { vector.y += 0.03787879f; } if (!cachedGraphics.TryGetValue(carriedThing, out var graphics)) { graphics = new Dictionary <int, Graphic>(); cachedGraphics[carriedThing] = graphics; } if (!graphics.TryGetValue(curLevel, out var graphic)) { Vector2 drawSize = carriedThing.Graphic.drawSize; drawSize.x *= 1f - ((curLevel - baseLevel) / DrawDynamicThings.pawnDrawScale); drawSize.y *= 1f - ((curLevel - baseLevel) / DrawDynamicThings.pawnDrawScale); if (carriedThing.Graphic is Graphic_RandomRotated graphicRandomRotated) { graphic = graphicRandomRotated.subGraphic.GetCopy(drawSize); } else { graphic = carriedThing.Graphic.GetCopy(drawSize); } graphics[curLevel] = graphic; } graphic.Draw(vector, carriedThing.Rotation, carriedThing); } } if (!invisible) { 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 { float angle = this.BodyAngle(); Rot4 rot = this.LayingFacing(); Building_Bed building_Bed = this.pawn.CurrentBed(); bool renderBody; Vector3 rootLoc; if (building_Bed != null && this.pawn.RaceProps.Humanlike) { renderBody = building_Bed.def.building.bed_showSleeperBody; AltitudeLayer altLayer = (AltitudeLayer)Mathf.Max((int)building_Bed.def.altitudeLayer, 16); Vector3 vector2; Vector3 a = vector2 = this.pawn.Position.ToVector3ShiftedWithAltitude(altLayer); vector2.y += 0.0265151523f; Rot4 rotation = building_Bed.Rotation; rotation.AsInt += 2; float d = -this.BaseHeadOffsetAt(Rot4.South).z; Vector3 a2 = rotation.FacingCell.ToVector3(); rootLoc = a + a2 * d; rootLoc.y += 0.007575758f; } else { renderBody = true; rootLoc = drawLoc; if (!this.pawn.Dead && this.pawn.CarriedBy == null) { rootLoc.y = AltitudeLayer.LayingPawn.AltitudeFor() + 0.007575758f; } } this.RenderPawnInternal(rootLoc, angle, renderBody, rot, rot, bodyDrawType, false, headStump, invisible, curLevel, baseLevel); } if (this.pawn.Spawned && !this.pawn.Dead) { this.pawn.stances.StanceTrackerDraw(); this.pawn.pather.PatherDraw(); } }
// 仮 private static void MakeBaseGeometry(Section section, LayerSubMesh sm, AltitudeLayer altitudeLayer) { sm.Clear(MeshParts.Verts | MeshParts.Tris); var cellRect = new CellRect(section.botLeft.x, section.botLeft.z, 17, 17); cellRect.ClipInsideMap(section.map); var y = altitudeLayer.AltitudeFor(); sm.verts.Capacity = cellRect.Area * 9; for (var i = cellRect.minX; i <= cellRect.maxX; i++) { for (var j = cellRect.minZ; j <= cellRect.maxZ; j++) { sm.verts.Add(new Vector3(i, y, j)); sm.verts.Add(new Vector3(i, y, j + 0.5f)); sm.verts.Add(new Vector3(i, y, j + 1)); sm.verts.Add(new Vector3(i + 0.5f, y, j + 1)); sm.verts.Add(new Vector3(i + 1, y, j + 1)); sm.verts.Add(new Vector3(i + 1, y, j + 0.5f)); sm.verts.Add(new Vector3(i + 1, y, j)); sm.verts.Add(new Vector3(i + 0.5f, y, j)); sm.verts.Add(new Vector3(i + 0.5f, y, j + 0.5f)); } } var num = cellRect.Area * 8 * 3; sm.tris.Capacity = num; var num2 = 0; while (sm.tris.Count < num) { sm.tris.Add(num2 + 7); sm.tris.Add(num2); sm.tris.Add(num2 + 1); sm.tris.Add(num2 + 1); sm.tris.Add(num2 + 2); sm.tris.Add(num2 + 3); sm.tris.Add(num2 + 3); sm.tris.Add(num2 + 4); sm.tris.Add(num2 + 5); sm.tris.Add(num2 + 5); sm.tris.Add(num2 + 6); sm.tris.Add(num2 + 7); sm.tris.Add(num2 + 7); sm.tris.Add(num2 + 1); sm.tris.Add(num2 + 8); sm.tris.Add(num2 + 1); sm.tris.Add(num2 + 3); sm.tris.Add(num2 + 8); sm.tris.Add(num2 + 3); sm.tris.Add(num2 + 5); sm.tris.Add(num2 + 8); sm.tris.Add(num2 + 5); sm.tris.Add(num2 + 7); sm.tris.Add(num2 + 8); num2 += 9; } sm.FinalizeMesh(MeshParts.Verts | MeshParts.Tris); }