public void DrawEquipmentAiming(Thing eq, Vector3 drawLoc, float aimAngle) { float num = aimAngle - 90f; Mesh mesh; if (aimAngle > 20f && aimAngle < 160f) { mesh = MeshPool.plane10; num += eq.def.equippedAngleOffset; } else if (aimAngle > 200f && aimAngle < 340f) { mesh = MeshPool.plane10Flip; num -= 180f; num -= eq.def.equippedAngleOffset; } else { mesh = MeshPool.plane10; num += eq.def.equippedAngleOffset; } num %= 360f; Graphic_StackCount graphic_StackCount = eq.Graphic as Graphic_StackCount; Material matSingle; if (graphic_StackCount != null) { matSingle = graphic_StackCount.SubGraphicForStackCount(1, eq.def).MatSingle; } else { matSingle = eq.Graphic.MatSingle; } Graphics.DrawMesh(mesh, drawLoc, Quaternion.AngleAxis(num, Vector3.up), matSingle, 0); }
public void DrawEquipmentAiming(Thing eq, Vector3 drawLoc, float aimAngle) { Mesh mesh = null; float num = aimAngle - 90f; if (aimAngle > 20f && aimAngle < 160f) { mesh = MeshPool.plane10; num += eq.def.equippedAngleOffset; } else if (aimAngle > 200f && aimAngle < 340f) { mesh = MeshPool.plane10Flip; num -= 180f; num -= eq.def.equippedAngleOffset; } else { mesh = MeshPool.plane10; num += eq.def.equippedAngleOffset; } num %= 360f; Material material = null; Graphic_StackCount graphic_StackCount = eq.Graphic as Graphic_StackCount; Graphics.DrawMesh(material: (graphic_StackCount == null) ? eq.Graphic.MatSingle : graphic_StackCount.SubGraphicForStackCount(1, eq.def).MatSingle, mesh: mesh, position: drawLoc, rotation: Quaternion.AngleAxis(num, Vector3.up), layer: 0); }
public void DrawEquipmentAiming(Thing eq, Vector3 drawLoc, float aimAngle) { Mesh mesh = null; float num = (float)(aimAngle - 90.0); if (aimAngle > 20.0 && aimAngle < 160.0) { mesh = MeshPool.plane10; num += eq.def.equippedAngleOffset; } else if (aimAngle > 200.0 && aimAngle < 340.0) { mesh = MeshPool.plane10Flip; num = (float)(num - 180.0); num -= eq.def.equippedAngleOffset; } else { mesh = MeshPool.plane10; num += eq.def.equippedAngleOffset; } num = (float)(num % 360.0); Material material = null; Graphic_StackCount graphic_StackCount = eq.Graphic as Graphic_StackCount; material = ((graphic_StackCount == null) ? eq.Graphic.MatSingle : graphic_StackCount.SubGraphicForStackCount(1, eq.def).MatSingle); Graphics.DrawMesh(mesh, drawLoc, Quaternion.AngleAxis(num, Vector3.up), material, 0); }
protected virtual void ResolveIcon() { if (graphic != null && graphic != BaseContent.BadGraphic) { Graphic outerGraphic = graphic; if (uiIconForStackCount >= 1 && this is ThingDef) { Graphic_StackCount graphic_StackCount = graphic as Graphic_StackCount; if (graphic_StackCount != null) { outerGraphic = graphic_StackCount.SubGraphicForStackCount(uiIconForStackCount, (ThingDef)this); } } Material material = outerGraphic.ExtractInnerGraphicFor(null).MatAt(defaultPlacingRot); uiIcon = (Texture2D)material.mainTexture; uiIconColor = material.color; } }