public void UpdateMealColors() { int i; for (i = 0; i < mPlayerMeals.Count; ++i) { mPlayerMeals[i].image.color = mPlayerMeals[i].colors.normalColor; } List <int> poisonedMealIndexes = mRestaurantScript.GetPoisonedMealIndexes(); bool marked = false; for (i = 0; i < poisonedMealIndexes.Count; ++i) { int index = poisonedMealIndexes[i]; Debug.Log(mRestaurantScript != null); if (index == mRestaurantScript.GetMarkedPlayerIndex()) { mPlayerMeals[index].image.color = new Color(255, 0, 255); marked = true; } else { Debug.Log(mPlayerMeals != null); mPlayerMeals[index].image.color = Color.red; } } if (!marked) { mPlayerMeals[mRestaurantScript.GetMarkedPlayerIndex()].image.color = Color.blue; } }
public void UpdateMealColors() { int i; for (i = 0; i < mPlayerMeals.Count; ++i) { mPlayerMeals[i].image.color = Color.white; } List <int> poisonedMealIndexes = mRestaurantScript.GetPoisonedMealIndexes(); int markedIndex = mRestaurantScript.GetMarkedPlayerIndex(); bool markedSet = false; for (i = 0; i < poisonedMealIndexes.Count; ++i) { int poisonedIndex = poisonedMealIndexes[i]; if (poisonedIndex != markedIndex) { mPlayerMeals[poisonedMealIndexes[i]].image.color = Color.red; } else { mPlayerMeals[poisonedMealIndexes[i]].image.color = new Color(255, 0, 255); markedSet = true; } } if (!markedSet) { mPlayerMeals[mRestaurantScript.GetMarkedPlayerIndex()].image.color = Color.blue; } }