public void DrawDiseaseIndicator(Rect rect, CapacityUtility.DiseaseProgress disease) { // draw immunity Rect immunityRect = rect.ContractedBy(Mathf.Lerp(rect.width / 2f, 0f, disease.immunity)); GUI.color = new Color(1f, 1f, 1f, Mathf.Lerp(.5f, 1f, disease.immunity)); GUI.DrawTexture(immunityRect, Resources.Circle); // draw disease progress Rect diseaseProgressRect = rect.ContractedBy(Mathf.Lerp(rect.width / 2f, 0f, disease.severity)); GUI.color = new Color(1f, .2f, .2f, Mathf.Lerp(.5f, 1f, disease.severity)); GUI.DrawTexture(diseaseProgressRect, Resources.Circle); string label = $"{disease.label}: severity; {disease.severity.ToStringPercent()}, immunity; {disease.immunity.ToStringPercent()}"; if (!disease.tended) { label += ", " + "NeedsTendingNow".Translate(); } else if (disease.tillTendTicks > 0) { label += ", " + "NextTendIn".Translate(new object[] { disease.tillTendTicks.ToStringTicksToPeriod() }); } GUI.color = Color.white; TooltipHandler.TipRegion(rect, () => label, rect.GetHashCode()); // draw indicator GUI.color = disease.tended ? Color.white : Color.gray; GUI.DrawTexture(rect, Resources.DashCircle); }
public void DrawDiseaseIndicator(Rect rect, CapacityUtility.DiseaseProgress disease) { // draw immunity Rect immunityRect = rect.ContractedBy(Mathf.Lerp(rect.width / 2f, 0f, disease.immunity)); GUI.color = new Color(1f, 1f, 1f, Mathf.Lerp(.5f, 1f, disease.immunity)); GUI.DrawTexture(immunityRect, Resources.Circle); // draw disease progress Rect diseaseProgressRect = rect.ContractedBy(Mathf.Lerp(rect.width / 2f, 0f, disease.severity)); GUI.color = new Color(1f, .2f, .2f, Mathf.Lerp(.5f, 1f, disease.severity)); GUI.DrawTexture(diseaseProgressRect, Resources.Circle); GUI.color = Color.white; // draw indicator GUI.color = disease.tended ? Color.white : Color.gray; GUI.DrawTexture(rect, Resources.DashCircle); }