public void ServeFood() { Debug.Log("SERVING FOOD! ;D"); int i; for (i = 0; i < mRestaurantScript.getAlivePlayers().Count; ++i) { //In the future create fun meals here depending on theme/course number. mRestaurantScript.addMeal(new Meal()); } }
public void ServeFood() { Debug.Log("SERVING FOOD! ;D"); int i; for (i = 0; i < mRestaurantScript.getAlivePlayers().Count; ++i) { //In the future create fun meals here depending on theme/course number. mRestaurantScript.addMeal(new Meal()); } List <Meal> mealsList = mRestaurantScript.getMeals(); //sets # of special meals depending on player count int numOfSpecialMeals = 0; switch (mRestaurantScript.getAlivePlayers().Count) { case 5: numOfSpecialMeals = 1; break; case 6: case 7: numOfSpecialMeals = 2; break; case 8: case 9: case 10: numOfSpecialMeals = 3; break; } //finds what meals to set as special List <int> specialMealIndices = new List <int>(); for (int j = 0; j < numOfSpecialMeals; j++) { int randomNum; do { randomNum = Random.Range(0, mRestaurantScript.getAlivePlayers().Count); } while(specialMealIndices.Contains(randomNum)); specialMealIndices.Add(randomNum); } //sets the randomly-selected meals for (int k = 0; k < mealsList.Count; k++) { if (specialMealIndices.Contains(k)) { mealsList [k].setSpecial(true); } else { mealsList [k].setSpecial(false); } } }
public void ServeFood() { Debug.Log("SERVING FOOD! ;D"); List <Color> plateColors = new List <Color>(mRestaurantScript.mPossibleColors); for (int i = 0; i < mRestaurantScript.getAlivePlayers().Count; ++i) { Debug.Log("HELLOOOO: " + mRestaurantScript.mPossibleColors.Length + " | " + i.ToString()); int randomIndex = getRandomNumber(0, plateColors.Count); //In the future create fun meals here depending on theme/course number. mRestaurantScript.addMeal(new Meal(mRestaurantScript.mMenuItems[(int)mCurrentRound], plateColors[randomIndex])); plateColors.RemoveAt(randomIndex); } List <Meal> mealsList = mRestaurantScript.getMeals(); //sets # of special meals depending on player count int numOfSpecialMeals = 0; switch (mRestaurantScript.getAlivePlayers().Count) { case 5: numOfSpecialMeals = 1; break; case 6: case 7: numOfSpecialMeals = 2; break; case 8: case 9: case 10: numOfSpecialMeals = 3; break; } //finds what meals to set as special List <int> specialMealIndices = new List <int>(); for (int j = 0; j < numOfSpecialMeals; j++) { int randomNum; do { randomNum = Random.Range(0, mRestaurantScript.getAlivePlayers().Count); } while(specialMealIndices.Contains(randomNum)); specialMealIndices.Add(randomNum); } //sets the randomly-selected meals for (int k = 0; k < mealsList.Count; k++) { if (specialMealIndices.Contains(k)) { mealsList [k].setSpecial(true); } else { mealsList [k].setSpecial(false); } } }