private static Color32 getDepositColor(ResourceDefinition definition, Deposit deposit) { Color32 color; if (deposit != null) { var ratio = (deposit.Quantity / definition.MaxQuantity); color = (Color32)(definition.ColorFull * ratio + definition.ColorEmpty * (1 - ratio)); } else { color = colorEmpty; } return color; }