public override void Print(SectionLayer layer) { Plant plant = this.Plant; if (plant != null) { GenPlant.SetWindExposureColors(Blight.workingColors, plant); } else { Blight.workingColors[0].a = (Blight.workingColors[1].a = (Blight.workingColors[2].a = (Blight.workingColors[3].a = 0))); } float num = Blight.SizeRange.LerpThroughRange(this.severity); if (plant != null) { float a = plant.Graphic.drawSize.x * plant.def.plant.visualSizeRange.LerpThroughRange(plant.Growth); num *= Mathf.Min(a, 1f); } num = Mathf.Clamp(num, 0.5f, 0.9f); Vector3 center = this.TrueCenter(); Vector2 size = this.def.graphic.drawSize * num; Material mat = this.Graphic.MatAt(base.Rotation, this); Color32[] colors = Blight.workingColors; Printer_Plane.PrintPlane(layer, center, size, mat, 0f, false, null, colors, 0.1f, 0f); }
public override void Print(SectionLayer layer) { Vector3 a = this.TrueCenter(); Rand.PushState(); Rand.Seed = base.Position.GetHashCode(); int num = Mathf.CeilToInt(this.growthInt * (float)this.def.plant.maxMeshCount); if (num < 1) { num = 1; } float num2 = this.def.plant.visualSizeRange.LerpThroughRange(this.growthInt); float num3 = this.def.graphicData.drawSize.x * num2; Vector3 vector = Vector3.zero; int num4 = 0; int[] positionIndices = PlantPosIndices.GetPositionIndices(this); bool flag = false; foreach (int num5 in positionIndices) { if (this.def.plant.maxMeshCount == 1) { vector = a + Gen.RandomHorizontalVector(0.05f); float num6 = (float)base.Position.z; if (vector.z - num2 / 2f < num6) { vector.z = num6 + num2 / 2f; flag = true; } } else { int num7 = 1; int maxMeshCount = this.def.plant.maxMeshCount; switch (maxMeshCount) { case 1: num7 = 1; break; default: if (maxMeshCount != 9) { if (maxMeshCount != 16) { if (maxMeshCount != 25) { Log.Error(this.def + " must have plant.MaxMeshCount that is a perfect square.", false); } else { num7 = 5; } } else { num7 = 4; } } else { num7 = 3; } break; case 4: num7 = 2; break; } float num8 = 1f / (float)num7; vector = base.Position.ToVector3(); vector.y = this.def.Altitude; vector.x += 0.5f * num8; vector.z += 0.5f * num8; int num9 = num5 / num7; int num10 = num5 % num7; vector.x += (float)num9 * num8; vector.z += (float)num10 * num8; float max = num8 * 0.3f; vector += Gen.RandomHorizontalVector(max); } bool @bool = Rand.Bool; Material matSingle = this.Graphic.MatSingle; GenPlant.SetWindExposureColors(Plant.workingColors, this); Vector2 vector2 = new Vector2(num3, num3); Vector3 center = vector; Vector2 size = vector2; Material mat = matSingle; bool flipUv = @bool; Printer_Plane.PrintPlane(layer, center, size, mat, 0f, flipUv, null, Plant.workingColors, 0.1f, (float)(this.HashOffset() % 1024)); num4++; if (num4 >= num) { break; } } if (this.def.graphicData.shadowData != null) { Vector3 center2 = a + this.def.graphicData.shadowData.offset * num2; if (flag) { center2.z = base.Position.ToVector3Shifted().z + this.def.graphicData.shadowData.offset.z; } center2.y -= 0.046875f; Vector3 volume = this.def.graphicData.shadowData.volume * num2; Printer_Shadow.PrintShadow(layer, center2, volume, Rot4.North); } Rand.PopState(); }
public override void Print(SectionLayer layer) { Vector3 a = this.TrueCenter(); Rand.PushState(); Rand.Seed = base.Position.GetHashCode(); int num = Mathf.CeilToInt(this.growthInt * (float)base.def.plant.maxMeshCount); if (num < 1) { num = 1; } float num2 = base.def.plant.visualSizeRange.LerpThroughRange(this.growthInt); float num3 = base.def.graphicData.drawSize.x * num2; Vector3 vector = Vector3.zero; int num4 = 0; int[] positionIndices = PlantPosIndices.GetPositionIndices(this); bool flag = false; int num5 = 0; while (num5 < positionIndices.Length) { int num6 = positionIndices[num5]; if (base.def.plant.maxMeshCount == 1) { vector = a + Gen.RandomHorizontalVector(0.05f); IntVec3 position = base.Position; float num7 = (float)position.z; if (vector.z - num2 / 2.0 < num7) { vector.z = (float)(num7 + num2 / 2.0); flag = true; } } else { int num8 = 1; switch (base.def.plant.maxMeshCount) { case 1: num8 = 1; break; case 4: num8 = 2; break; case 9: num8 = 3; break; case 16: num8 = 4; break; case 25: num8 = 5; break; default: Log.Error(base.def + " must have plant.MaxMeshCount that is a perfect square."); break; } float num9 = (float)(1.0 / (float)num8); vector = base.Position.ToVector3(); vector.y = base.def.Altitude; vector.x += (float)(0.5 * num9); vector.z += (float)(0.5 * num9); int num10 = num6 / num8; int num11 = num6 % num8; vector.x += (float)num10 * num9; vector.z += (float)num11 * num9; float max = (float)(num9 * 0.30000001192092896); vector += Gen.RandomHorizontalVector(max); } bool @bool = Rand.Bool; Material matSingle = this.Graphic.MatSingle; GenPlant.SetWindExposureColors(Plant.workingColors, this); Vector2 vector2 = new Vector2(num3, num3); Vector3 center = vector; Vector2 size = vector2; Material mat = matSingle; bool flipUv = @bool; Printer_Plane.PrintPlane(layer, center, size, mat, 0f, flipUv, null, Plant.workingColors, 0.1f); num4++; if (num4 < num) { num5++; continue; } break; } if (base.def.graphicData.shadowData != null) { Vector3 center2 = a + base.def.graphicData.shadowData.offset * num2; if (flag) { Vector3 center = base.Position.ToVector3Shifted(); center2.z = center.z + base.def.graphicData.shadowData.offset.z; } center2.y -= 0.046875f; Vector3 volume = base.def.graphicData.shadowData.volume * num2; Printer_Shadow.PrintShadow(layer, center2, volume, Rot4.North); } Rand.PopState(); }