private static bool ShouldHighlight(WearNTear wearNTear, Vector3 playerPos) { Vector3 wearNTearPos = WearsDataCache[wearNTear].pos; float distance = Vector3.Distance(wearNTearPos, playerPos); float healthPercentage = wearNTear.GetHealthPercentage(); float maxDistance = MaxDistance.Value; float healthDiffMinimum = 5f; if (HighlightedWears.Contains(wearNTear)) { if (distance > maxDistance) { HighlightedWears.Remove(wearNTear); wearNTear.ResetHighlight(); return(false); } float healthDif = Mathf.Abs(WearsDataCache[wearNTear].healthPercentage - healthPercentage); if (healthDif > healthDiffMinimum) { return(true); } else { return(false); } } if (distance <= maxDistance) { return(true); } else { return(false); } }