In the below code I wanted the foreach loop to see what the quality score was on each plant and if its higher than a certain value a star is added and or the text displayed above is changed. only one of these plants meets that criteria but all of the plants are adding a 3rd star and the text is changing to GREAT for all of them. what can I change to have the foreach loop check all plants and ONLY change the if statement criteria on each one if it meets it.
StrainAtributes[] plants = (StrainAtributes[]) GameObject.FindObjectsOfType (typeof(StrainAtributes));
foreach (StrainAtributes plant in plants) {
if (plant.qualityScore <= 19)
{
star1.sprite = starGold;
}
if (plant.qualityScore >= 20 && plant.qualityScore <= 29)
{
star2.sprite = starGold;
effect.AnimationManager.PlayAnimation();
}
else if (plant.qualityScore >= 30)
{
star3.sprite = starGold;
effect.text = "GREAT!";
effect.AnimationManager.PlayAnimation();
}
else {
}