public virtual void Print(SectionLayer layer, Thing thing) { Vector2 size; bool flag; if (this.ShouldDrawRotated) { size = this.drawSize; flag = false; } else { size = (thing.Rotation.IsHorizontal ? this.drawSize.Rotated() : this.drawSize); flag = (thing.Rotation == Rot4.West); if (this.data != null && !this.data.allowFlip) { flag = false; } } float num = 0f; if (this.ShouldDrawRotated) { num = thing.Rotation.AsAngle; } if (flag && this.data != null) { num += this.data.flipExtraRotation; } Printer_Plane.PrintPlane(layer, thing.TrueCenter(), size, this.MatAt(thing.Rotation, thing), num, flag, null, null, 0.01f); if (this.ShadowGraphic != null && thing != null) { this.ShadowGraphic.Print(layer, thing); } }
public virtual void Print(SectionLayer layer, Thing thing) { Vector2 size; bool flag; if (ShouldDrawRotated) { size = drawSize; flag = false; } else { size = (thing.Rotation.IsHorizontal ? drawSize.Rotated() : drawSize); flag = ((thing.Rotation == Rot4.West && WestFlipped) || (thing.Rotation == Rot4.East && EastFlipped)); } float num = AngleFromRot(thing.Rotation); if (flag && data != null) { num += data.flipExtraRotation; } Vector3 center = thing.TrueCenter() + DrawOffset(thing.Rotation); Printer_Plane.PrintPlane(layer, center, size, MatAt(thing.Rotation, thing), num, flag); if (ShadowGraphic != null && thing != null) { ShadowGraphic.Print(layer, thing); } }
public virtual void Print(SectionLayer layer, Thing thing) { Vector2 size; bool flag; if (this.ShouldDrawRotated) { size = this.drawSize; flag = false; } else { if (!thing.Rotation.IsHorizontal) { size = this.drawSize; } else { size = this.drawSize.Rotated(); } flag = ((thing.Rotation == Rot4.West && this.WestFlipped) || (thing.Rotation == Rot4.East && this.EastFlipped)); } float num = this.AngleFromRot(thing.Rotation); if (flag && this.data != null) { num += this.data.flipExtraRotation; } Printer_Plane.PrintPlane(layer, thing.TrueCenter(), size, this.MatAt(thing.Rotation, thing), num, flag, null, null, 0.01f, 0f); if (this.ShadowGraphic != null && thing != null) { this.ShadowGraphic.Print(layer, thing); } }
public override void Print(SectionLayer layer, Thing thing) { Vector3 a = thing.TrueCenter(); Rand.PushState(); Rand.Seed = thing.Position.GetHashCode(); Filth filth = thing as Filth; int num; if (filth == null) { num = 3; } else { num = filth.thickness; } for (int i = 0; i < num; i++) { Material matSingle = this.MatSingle; Vector3 center = a + new Vector3(Rand.Range(-0.45f, 0.45f), 0f, Rand.Range(-0.45f, 0.45f)); Vector2 size = new Vector2(Rand.Range(0.8f, 1.2f), Rand.Range(0.8f, 1.2f)); float rot = (float)Rand.RangeInclusive(0, 360); bool flipUv = Rand.Value < 0.5f; Printer_Plane.PrintPlane(layer, center, size, matSingle, rot, flipUv, null, null, 0.01f, 0f); } Rand.PopState(); }
private void DrawLinkableCornersAndEdges(Building b) { if (b.def.graphicData == null) { return; } DamageGraphicData damageData = b.def.graphicData.damageData; if (damageData == null) { return; } float damageTexturesAltitude = GetDamageTexturesAltitude(b); List <DamageOverlay> overlays = BuildingsDamageSectionLayerUtility.GetOverlays(b); IntVec3 position = b.Position; Vector3 vector = new Vector3((float)position.x + 0.5f, damageTexturesAltitude, (float)position.z + 0.5f); float x = Rand.Range(0.4f, 0.6f); float z = Rand.Range(0.4f, 0.6f); float x2 = Rand.Range(0.4f, 0.6f); float z2 = Rand.Range(0.4f, 0.6f); for (int i = 0; i < overlays.Count; i++) { switch (overlays[i]) { case DamageOverlay.TopEdge: Printer_Plane.PrintPlane(this, vector + new Vector3(x, 0f, 0f), Vector2.one, damageData.edgeTopMat, 0f, flipUv: false, null, null, 0f); break; case DamageOverlay.RightEdge: Printer_Plane.PrintPlane(this, vector + new Vector3(0f, 0f, z), Vector2.one, damageData.edgeRightMat, 90f, flipUv: false, null, null, 0f); break; case DamageOverlay.BotEdge: Printer_Plane.PrintPlane(this, vector + new Vector3(x2, 0f, 0f), Vector2.one, damageData.edgeBotMat, 180f, flipUv: false, null, null, 0f); break; case DamageOverlay.LeftEdge: Printer_Plane.PrintPlane(this, vector + new Vector3(0f, 0f, z2), Vector2.one, damageData.edgeLeftMat, 270f, flipUv: false, null, null, 0f); break; case DamageOverlay.TopLeftCorner: Printer_Plane.PrintPlane(this, vector, Vector2.one, damageData.cornerTLMat, 0f, flipUv: false, null, null, 0f); break; case DamageOverlay.TopRightCorner: Printer_Plane.PrintPlane(this, vector, Vector2.one, damageData.cornerTRMat, 90f, flipUv: false, null, null, 0f); break; case DamageOverlay.BotRightCorner: Printer_Plane.PrintPlane(this, vector, Vector2.one, damageData.cornerBRMat, 180f, flipUv: false, null, null, 0f); break; case DamageOverlay.BotLeftCorner: Printer_Plane.PrintPlane(this, vector, Vector2.one, damageData.cornerBLMat, 270f, flipUv: false, null, null, 0f); break; } } }
private void DrawFullThingCorners(Building b) { if (b.def.graphicData == null) { return; } if (b.def.graphicData.damageData == null) { return; } Rect damageRect = BuildingsDamageSectionLayerUtility.GetDamageRect(b); float damageTexturesAltitude = this.GetDamageTexturesAltitude(b); float num = Mathf.Min(Mathf.Min(damageRect.width, damageRect.height), 1.5f); Material mat; Material mat2; Material mat3; Material mat4; BuildingsDamageSectionLayerUtility.GetCornerMats(out mat, out mat2, out mat3, out mat4, b); float num2 = num * Rand.Range(0.9f, 1f); float num3 = num * Rand.Range(0.9f, 1f); float num4 = num * Rand.Range(0.9f, 1f); float num5 = num * Rand.Range(0.9f, 1f); List <DamageOverlay> overlays = BuildingsDamageSectionLayerUtility.GetOverlays(b); for (int i = 0; i < overlays.Count; i++) { switch (overlays[i]) { case DamageOverlay.TopLeftCorner: { Rect rect = new Rect(damageRect.xMin, damageRect.yMax - num2, num2, num2); Printer_Plane.PrintPlane(this, new Vector3(rect.center.x, damageTexturesAltitude, rect.center.y), rect.size, mat, 0f, false, null, null, 0f, 0f); break; } case DamageOverlay.TopRightCorner: { Rect rect2 = new Rect(damageRect.xMax - num3, damageRect.yMax - num3, num3, num3); Printer_Plane.PrintPlane(this, new Vector3(rect2.center.x, damageTexturesAltitude, rect2.center.y), rect2.size, mat2, 90f, false, null, null, 0f, 0f); break; } case DamageOverlay.BotLeftCorner: { Rect rect3 = new Rect(damageRect.xMin, damageRect.yMin, num5, num5); Printer_Plane.PrintPlane(this, new Vector3(rect3.center.x, damageTexturesAltitude, rect3.center.y), rect3.size, mat4, 270f, false, null, null, 0f, 0f); break; } case DamageOverlay.BotRightCorner: { Rect rect4 = new Rect(damageRect.xMax - num4, damageRect.yMin, num4, num4); Printer_Plane.PrintPlane(this, new Vector3(rect4.center.x, damageTexturesAltitude, rect4.center.y), rect4.size, mat3, 180f, false, null, null, 0f, 0f); break; } } } }
public override void Print(SectionLayer layer, Thing thing) { base.Print(layer, thing); IntVec3 position = thing.Position; for (int i = 0; i < 4; i++) { IntVec3 c = thing.Position + GenAdj.DiagonalDirectionsAround[i]; if (this.ShouldLinkWith(c, thing)) { if (i != 0 || (this.ShouldLinkWith(position + IntVec3.West, thing) && this.ShouldLinkWith(position + IntVec3.South, thing))) { if (i != 1 || (this.ShouldLinkWith(position + IntVec3.West, thing) && this.ShouldLinkWith(position + IntVec3.North, thing))) { if (i != 2 || (this.ShouldLinkWith(position + IntVec3.East, thing) && this.ShouldLinkWith(position + IntVec3.North, thing))) { if (i != 3 || (this.ShouldLinkWith(position + IntVec3.East, thing) && this.ShouldLinkWith(position + IntVec3.South, thing))) { Vector3 vector = thing.DrawPos + GenAdj.DiagonalDirectionsAround[i].ToVector3().normalized *Graphic_LinkedCornerFiller.CoverOffsetDist + Altitudes.AltIncVect + new Vector3(0f, 0f, 0.09f); Vector2 vector2 = new Vector2(0.5f, 0.5f); if (!c.InBounds(thing.Map)) { if (c.x == -1) { vector.x -= 1f; vector2.x *= 5f; } if (c.z == -1) { vector.z -= 1f; vector2.y *= 5f; } if (c.x == thing.Map.Size.x) { vector.x += 1f; vector2.x *= 5f; } if (c.z == thing.Map.Size.z) { vector.z += 1f; vector2.y *= 5f; } } Vector3 center = vector; Vector2 size = vector2; Material mat = base.LinkedDrawMatFrom(thing, thing.Position); float rot = 0f; Vector2[] cornerFillUVs = Graphic_LinkedCornerFiller.CornerFillUVs; Printer_Plane.PrintPlane(layer, center, size, mat, rot, false, cornerFillUVs, null, 0.01f); } } } } } } }
private void PrintScratches(Building b) { int num = 0; List <DamageOverlay> overlays = BuildingsDamageSectionLayerUtility.GetOverlays(b); for (int i = 0; i < overlays.Count; i++) { if (overlays[i] == DamageOverlay.Scratch) { num++; } } if (num == 0) { return; } Rect damageRect = BuildingsDamageSectionLayerUtility.GetDamageRect(b); float num2 = Mathf.Min(0.5f * Mathf.Min(damageRect.width, damageRect.height), 1f); damageRect = damageRect.ContractedBy(num2 / 2f); if (damageRect.width <= 0f || damageRect.height <= 0f) { return; } float minDist = Mathf.Max(damageRect.width, damageRect.height) * 0.7f; scratches.Clear(); Rand.PushState(); Rand.Seed = b.thingIDNumber * 3697; for (int j = 0; j < num; j++) { AddScratch(b, damageRect.width, damageRect.height, ref minDist); } Rand.PopState(); float damageTexturesAltitude = GetDamageTexturesAltitude(b); IList <Material> scratchMats = BuildingsDamageSectionLayerUtility.GetScratchMats(b); Rand.PushState(); Rand.Seed = b.thingIDNumber * 7; for (int k = 0; k < scratches.Count; k++) { float x = scratches[k].x; float y = scratches[k].y; float rot = Rand.Range(0f, 360f); float num3 = num2; if (damageRect.width > 0.95f && damageRect.height > 0.95f) { num3 *= Rand.Range(0.85f, 1f); } Vector3 center = new Vector3(damageRect.xMin + x, damageTexturesAltitude, damageRect.yMin + y); Printer_Plane.PrintPlane(this, center, new Vector2(num3, num3), scratchMats.RandomElement(), rot, flipUv: false, null, null, 0f); } Rand.PopState(); }
private void PrintScratches(Building b) { int num = 0; List <DamageOverlay> overlays = BuildingsDamageSectionLayerUtility.GetOverlays(b); for (int i = 0; i < overlays.Count; i++) { if (overlays[i] == DamageOverlay.Scratch) { num++; } } if (num != 0) { Rect rect = BuildingsDamageSectionLayerUtility.GetDamageRect(b); float num2 = Mathf.Min((float)(0.5 * Mathf.Min(rect.width, rect.height)), 1f); rect = rect.ContractedBy((float)(num2 / 2.0)); if (!(rect.width <= 0.0) && !(rect.height <= 0.0)) { float num3 = (float)(Mathf.Max(rect.width, rect.height) * 0.699999988079071); SectionLayer_BuildingsDamage.scratches.Clear(); Rand.PushState(); Rand.Seed = b.thingIDNumber * 3697; for (int j = 0; j < num; j++) { this.AddScratch(b, rect.width, rect.height, ref num3); } Rand.PopState(); float damageTexturesAltitude = this.GetDamageTexturesAltitude(b); IList <Material> scratchMats = BuildingsDamageSectionLayerUtility.GetScratchMats(b); Rand.PushState(); Rand.Seed = b.thingIDNumber * 7; for (int k = 0; k < SectionLayer_BuildingsDamage.scratches.Count; k++) { Vector2 vector = SectionLayer_BuildingsDamage.scratches[k]; float x = vector.x; Vector2 vector2 = SectionLayer_BuildingsDamage.scratches[k]; float y = vector2.y; float rot = Rand.Range(0f, 360f); float num4 = num2; if (rect.width > 0.949999988079071 && rect.height > 0.949999988079071) { num4 *= Rand.Range(0.85f, 1f); } Vector3 center = new Vector3(rect.xMin + x, damageTexturesAltitude, rect.yMin + y); Printer_Plane.PrintPlane(this, center, new Vector2(num4, num4), scratchMats.RandomElement(), rot, false, null, null, 0f); } Rand.PopState(); } } }
public override void Print(SectionLayer layer, Thing thing) { Vector3 a = thing.TrueCenter(); Rand.PushState(); Rand.Seed = thing.Position.GetHashCode(); int num = (thing as Filth)?.thickness ?? 3; for (int i = 0; i < num; i++) { Material matSingle = MatSingle; Vector3 center = a + new Vector3(Rand.Range(-0.45f, 0.45f), 0f, Rand.Range(-0.45f, 0.45f)); Vector2 size = new Vector2(Rand.Range(data.drawSize.x * 0.8f, data.drawSize.x * 1.2f), Rand.Range(data.drawSize.y * 0.8f, data.drawSize.y * 1.2f)); float rot = Rand.RangeInclusive(0, 360); bool flipUv = Rand.Value < 0.5f; Printer_Plane.PrintPlane(layer, center, size, matSingle, rot, flipUv); } Rand.PopState(); }
public override void Print(SectionLayer layer, Thing thing) { base.Print(layer, thing); IntVec3 position = thing.Position; for (int i = 0; i < 4; i++) { IntVec3 c = thing.Position + GenAdj.DiagonalDirectionsAround[i]; if (!ShouldLinkWith(c, thing) || (i == 0 && (!ShouldLinkWith(position + IntVec3.West, thing) || !ShouldLinkWith(position + IntVec3.South, thing))) || (i == 1 && (!ShouldLinkWith(position + IntVec3.West, thing) || !ShouldLinkWith(position + IntVec3.North, thing))) || (i == 2 && (!ShouldLinkWith(position + IntVec3.East, thing) || !ShouldLinkWith(position + IntVec3.North, thing))) || (i == 3 && (!ShouldLinkWith(position + IntVec3.East, thing) || !ShouldLinkWith(position + IntVec3.South, thing)))) { continue; } Vector3 center = thing.DrawPos + GenAdj.DiagonalDirectionsAround[i].ToVector3().normalized *CoverOffsetDist + Altitudes.AltIncVect + new Vector3(0f, 0f, 0.09f); Vector2 size = new Vector2(0.5f, 0.5f); if (!c.InBounds(thing.Map)) { if (c.x == -1) { center.x -= 1f; size.x *= 5f; } if (c.z == -1) { center.z -= 1f; size.y *= 5f; } if (c.x == thing.Map.Size.x) { center.x += 1f; size.x *= 5f; } if (c.z == thing.Map.Size.z) { center.z += 1f; size.y *= 5f; } } Printer_Plane.PrintPlane(layer, center, size, LinkedDrawMatFrom(thing, thing.Position), 0f, flipUv: false, CornerFillUVs); } }
public override void Print(SectionLayer layer, Thing thing) { Material mat = this.LinkedDrawMatFrom(thing, thing.Position); Printer_Plane.PrintPlane(layer, thing.TrueCenter(), new Vector2(1f, 1f), mat, 0f, false, null, null, 0.01f, 0f); }
public void PrintOnto(SectionLayer layer) { Printer_Plane.PrintPlane(layer, this.loc, Vector2.one * this.size, this.def.mat, this.rotation, false, null, null, 0.01f, 0f); }
private void DrawFullThingCorners(Building b) { if (b.def.graphicData != null) { DamageGraphicData damageData = b.def.graphicData.damageData; if (damageData != null) { Rect damageRect = BuildingsDamageSectionLayerUtility.GetDamageRect(b); float damageTexturesAltitude = GetDamageTexturesAltitude(b); float num = Mathf.Min(Mathf.Min(damageRect.width, damageRect.height), 1.5f); BuildingsDamageSectionLayerUtility.GetCornerMats(out Material topLeft, out Material topRight, out Material botRight, out Material botLeft, b); float num2 = num * Rand.Range(0.9f, 1f); float num3 = num * Rand.Range(0.9f, 1f); float num4 = num * Rand.Range(0.9f, 1f); float num5 = num * Rand.Range(0.9f, 1f); List <DamageOverlay> overlays = BuildingsDamageSectionLayerUtility.GetOverlays(b); for (int i = 0; i < overlays.Count; i++) { switch (overlays[i]) { case DamageOverlay.TopLeftCorner: { Rect rect4 = new Rect(damageRect.xMin, damageRect.yMax - num2, num2, num2); Vector2 center7 = rect4.center; float x4 = center7.x; float y4 = damageTexturesAltitude; Vector2 center8 = rect4.center; Printer_Plane.PrintPlane(this, new Vector3(x4, y4, center8.y), rect4.size, topLeft, 0f, flipUv: false, null, null, 0f); break; } case DamageOverlay.TopRightCorner: { Rect rect3 = new Rect(damageRect.xMax - num3, damageRect.yMax - num3, num3, num3); Vector2 center5 = rect3.center; float x3 = center5.x; float y3 = damageTexturesAltitude; Vector2 center6 = rect3.center; Printer_Plane.PrintPlane(this, new Vector3(x3, y3, center6.y), rect3.size, topRight, 90f, flipUv: false, null, null, 0f); break; } case DamageOverlay.BotRightCorner: { Rect rect2 = new Rect(damageRect.xMax - num4, damageRect.yMin, num4, num4); Vector2 center3 = rect2.center; float x2 = center3.x; float y2 = damageTexturesAltitude; Vector2 center4 = rect2.center; Printer_Plane.PrintPlane(this, new Vector3(x2, y2, center4.y), rect2.size, botRight, 180f, flipUv: false, null, null, 0f); break; } case DamageOverlay.BotLeftCorner: { Rect rect = new Rect(damageRect.xMin, damageRect.yMin, num5, num5); Vector2 center = rect.center; float x = center.x; float y = damageTexturesAltitude; Vector2 center2 = rect.center; Printer_Plane.PrintPlane(this, new Vector3(x, y, center2.y), rect.size, botLeft, 270f, flipUv: false, null, null, 0f); break; } } } } } }
public void PrintOnto(SectionLayer layer) { Printer_Plane.PrintPlane(layer, loc, Vector2.one * size, def.mat, rotation); }