public void UpdateMealColors() { int i; for (i = 0; i < mPlayerMeals.Count; ++i) { mPlayerMeals[i].image.color = mRestaurantScript.getMeals()[i].getPlateColor(); } /*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 * { * mPlayerMeals[index].image.color = new Color(255, 0, 0); * } * } * * 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 = mRestaurantScript.getMeals()[i].getPlateColor(); } }
private void FindDead() { List <Meal> mealsList = mRestaurantScript.getMeals(); List <Player> alivePlayersList = mRestaurantScript.getAlivePlayers(); for (int i = 0; i < mealsList.Count; i++) { if (mealsList [i].isPoisoned()) { Debug.Log("Poisoned meal number is: " + i.ToString()); if (alivePlayersList[i].getRole() == EnumPlayerRole.ASSASSIN || alivePlayersList[i].getLastMealEaten() == EnumSpecialMeal.STOMACHACHE) { Debug.Log("No one has been poisoned!"); } else { Debug.Log(alivePlayersList[i].getName() + " has been poisoned!"); mRestaurantScript.VotePlayerOffTheIsland(alivePlayersList [i]); } break; } } }
private void FindDead() { List <Meal> mealsList = mRestaurantScript.getMeals(); List <Player> alivePlayersList = mRestaurantScript.getAlivePlayers(); for (int i = 0; i < mealsList.Count; i++) { if (mealsList [i].isPoisoned()) { Debug.Log("Poisoned meal number is: " + i.ToString()); if (alivePlayersList [i].getRole() == EnumPlayerRole.ASSASSIN || alivePlayersList [i].getLastMealEaten() == EnumSpecialMeal.STOMACHACHE) { Debug.Log("No one has been poisoned!"); mVoteScreenTitleText.text = "NO ONE HAS BEEN POISONED!"; mVoteScreenSecondaryText.text = "NO NEED TO CALL THE COPS, I GUESS?."; mVotingIsHappening = false; } else if (alivePlayersList.Count > 4) { Debug.Log(alivePlayersList [i].getName() + " has been poisoned!"); mVoteScreenTitleText.text = alivePlayersList [i].getName().ToUpper() + " HAS BEEN POISONED!"; mVoteScreenSecondaryText.text = "DECIDE WHO YOU WANT TO CALL THE COPS ON."; mRestaurantScript.VotePlayerOffTheIsland(alivePlayersList [i]); mVotingIsHappening = true; } else { Debug.Log(alivePlayersList [i].getName() + " has been poisoned!"); mVoteScreenTitleText.text = alivePlayersList [i].getName().ToUpper() + " HAS BEEN POISONED!"; mVoteScreenSecondaryText.text = "YOU DON'T HAVE ENOUGH PEOPLE AS WITNESSES FOR THE COPS TO BELIEVE YOU."; mRestaurantScript.VotePlayerOffTheIsland(alivePlayersList [i]); mVotingIsHappening = false; } break; } } }
private void ResetRound() { mRestaurantScript.getMeals().Clear(); mRestaurantScript.resetPlayersWithTurnsLeft(); }
public void ServeFood() { Debug.Log("SERVING FOOD! ;D"); for (int i = 0; i < mRestaurantScript.getAlivePlayers().Count; ++i) { Debug.Log("HELLOOOO: " + mRestaurantScript.mPossibleColors.Length + " | " + i.ToString()); //In the future create fun meals here depending on theme/course number. mRestaurantScript.addMeal(new Meal(mRestaurantScript.mMenuItems[(int)mCurrentRound], mRestaurantScript.mPossibleColors[i])); } 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); } } }