private void ShowRole() { List <Player> players = mRestaurantScript.getAlivePlayers(); EnumPlayerRole role = players[mTurnManagerScript.GetCurrentPlayerIndex()].getRole(); string roleWithPrefix = players[mTurnManagerScript.GetCurrentPlayerIndex()].getRoleAsStringWithPrefix(); mRoleText.text = "YOU ARE " + roleWithPrefix.ToUpper() + "."; switch (role) { case EnumPlayerRole.ASSASSIN: SetCharacterArt(mAssassinSprite); break; case EnumPlayerRole.CHEMIST: SetCharacterArt(mChemistSprite); break; case EnumPlayerRole.DISTANT_COUSIN: SetCharacterArt(mDistantCousinSprite); break; case EnumPlayerRole.FOOD_CRITIC: SetCharacterArt(mFoodCriticSprite); break; case EnumPlayerRole.PARTY_GOER: SetCharacterArt(mPartygoerSprite); break; case EnumPlayerRole.PRIVATE_EYE: SetCharacterArt(mPrivateEyeSprite); break; case EnumPlayerRole.SCAPEGOAT: SetCharacterArt(mScapegoatSprite); break; case EnumPlayerRole.WEALTHY_COUPLE: if (mRestaurantScript.mWCSpritesAssigned) { if (players [mTurnManagerScript.GetCurrentPlayerIndex()] == mRestaurantScript.mWealthyCouple1Player) { SetCharacterArt(mRestaurantScript.mWealthyCouple1Sprite); } else { SetCharacterArt(mRestaurantScript.mWealthyCouple2Sprite); } } //assigns sprites if unassigned else { if (mRestaurantScript.mWealthyCouple1Player == null) { mRestaurantScript.mWealthyCouple1Player = players [mTurnManagerScript.GetCurrentPlayerIndex()]; if (Random.Range(0, 2) == 0) { mRestaurantScript.mWealthyCouple1Sprite = mWealthyCouple1Sprite; } else { mRestaurantScript.mWealthyCouple1Sprite = mWealthyCouple2Sprite; } SetCharacterArt(mRestaurantScript.mWealthyCouple1Sprite); } else { if (Random.Range(0, 2) == 0) { mRestaurantScript.mWealthyCouple2Sprite = mWealthyCouple1Sprite; } else { mRestaurantScript.mWealthyCouple2Sprite = mWealthyCouple2Sprite; } SetCharacterArt(mRestaurantScript.mWealthyCouple2Sprite); mRestaurantScript.mWCSpritesAssigned = true; } } break; } switch (role) { case EnumPlayerRole.ASSASSIN: List <EnumPlayerRole> unusedRoles = mRestaurantScript.getUnusedRoles(); Player roleOne = new Player("r1", unusedRoles [0]); Player roleTwo = new Player("r2", unusedRoles [1]); mRoleText.text += "\n" + roleOne.getRoleAsStringWithPrefix().ToUpper() + " AND " + roleTwo.getRoleAsStringWithPrefix().ToUpper() + " DID NOT COME TO THE PARTY."; SetButtonAction("POISON FOOD", delegate { ShowPoisonScreen(EnumPlayerRole.ASSASSIN); }); break; case EnumPlayerRole.DISTANT_COUSIN: Player wealthyCouple1 = new Player("", EnumPlayerRole.PARTY_GOER); Player wealthyCouple2 = new Player("", EnumPlayerRole.PARTY_GOER); Player assassin = new Player("", EnumPlayerRole.PARTY_GOER); bool firstWealthyCoupleFound = false; for (int i = 0; i < players.Count; i++) { if (players[i].getRole() == EnumPlayerRole.WEALTHY_COUPLE) { if (!firstWealthyCoupleFound) { wealthyCouple1 = players[i]; firstWealthyCoupleFound = true; } else { wealthyCouple2 = players[i]; } } else if (players[i].getRole() == EnumPlayerRole.ASSASSIN) { assassin = players[i]; } } if (mTurnManagerScript.mCurrentRound == EnumCourse.ENTREE) { mRoleText.text += "\n" + assassin.getName().ToUpper() + " IS THE ASSASSIN." + "\nTHE WEALTHY COUPLE HAS " + wealthyCouple1.getName().ToUpper(); if (wealthyCouple1.getRole() == EnumPlayerRole.WEALTHY_COUPLE) { mRoleText.text += "\nAND " + wealthyCouple2.getName().ToUpper() + "."; } mRoleText.text += "\nCHOOSE WHO TO MARK."; SetButtonAction("MARK PLAYER", ShowMarkScreen); } else if (!isAssassinAlive()) { mRoleText.text += "\nTHE ASSASSIN IS OUT!" + "\nTHE WEALTHY COUPLE HAS " + wealthyCouple1.getName().ToUpper(); if (wealthyCouple1.getRole() == EnumPlayerRole.WEALTHY_COUPLE) { mRoleText.text += "\nAND " + wealthyCouple2.getName().ToUpper() + "."; } mRoleText.text += "\nCHOOSE WHO TO POISON."; SetButtonAction("POISON FOOD", delegate { ShowPoisonScreen(EnumPlayerRole.DISTANT_COUSIN); }); } else { mRoleText.text += "\n" + assassin.getName().ToUpper() + " IS THE ASSASSIN." + "\nTHE WEALTHY COUPLE HAS " + wealthyCouple1.getName().ToUpper(); if (wealthyCouple1.getRole() == EnumPlayerRole.WEALTHY_COUPLE) { mRoleText.text += "\nAND " + wealthyCouple2.getName().ToUpper() + "."; } SetButtonAction("GOT IT", OnConfirmButtonClicked); } break; case EnumPlayerRole.WEALTHY_COUPLE: for (int i = 0; i < players.Count; i++) { if (players[i].getRole() == EnumPlayerRole.WEALTHY_COUPLE && players[i] != players[mTurnManagerScript.GetCurrentPlayerIndex()]) { mRoleText.text += "\nYOUR PARTNER IS " + (players[i].getName()).ToUpper() + "." + "\nTAP THE BUTTON THREE TIMES TO CONTINUE."; } } SetButtonAction("GOT IT", OnConfirmButtonClicked); break; case EnumPlayerRole.PRIVATE_EYE: Player buggedPlayer = mRestaurantScript.getBuggedPlayer(); string saying; if (buggedPlayer == null) { saying = "\nTHE BUGGED MEAL DIDN'T PICK UP ON ANYTHING."; } else { saying = "\nYOU HAVE BUGGED " + (buggedPlayer.getName()).ToUpper() + "." + "\nTHEY ARE " + buggedPlayer.getRoleAsStringWithPrefix().ToUpper() + "."; mRestaurantScript.setBuggedPlayer(null); } switch (mTurnManagerScript.mCurrentRound) { case EnumCourse.ENTREE: mRoleText.text += "\nCHOOSE WHICH MEAL TO BUG."; SetButtonAction("BUG PLAYER", ShowBugScreen); break; case EnumCourse.MAIN: mRoleText.text += saying + "\nBUG A MEAL AGAIN."; SetButtonAction("BUG PLAYER", ShowBugScreen); break; case EnumCourse.DESSERT: mRoleText.text += saying; SetButtonAction("GOT IT", OnConfirmButtonClicked); break; } break; default: { mRoleText.text += "\nTAP THE BUTTON THREE TIMES TO CONTINUE."; SetButtonAction("GOT IT", OnConfirmButtonClicked); } break; } if (players [mTurnManagerScript.GetCurrentPlayerIndex()].getLastMealEaten() != EnumSpecialMeal.NORMAL) { mRoleText.text += "\nYOU ATE THE " + players [mTurnManagerScript.GetCurrentPlayerIndex()].getSpecialMealAsString().ToUpper() + " MEAL."; } }
private void ShowRole() { List <Player> players = mRestaurantScript.getAlivePlayers(); EnumPlayerRole role = players[mTurnManagerScript.GetCurrentPlayerIndex()].getRole(); string roleWithPrefix = players[mTurnManagerScript.GetCurrentPlayerIndex()].getRoleAsStringWithPrefix(); mRoleText.text = "YOU ARE " + roleWithPrefix.ToUpper() + "."; switch (role) { case EnumPlayerRole.ASSASSIN: SetButtonAction("POISON FOOD", delegate { ShowPoisonScreen(EnumPlayerRole.ASSASSIN); }); break; case EnumPlayerRole.DISTANT_COUSIN: Player wealthyCouple1 = new Player("", EnumPlayerRole.PARTY_GOER); Player wealthyCouple2 = new Player("", EnumPlayerRole.PARTY_GOER); Player assassin = new Player("", EnumPlayerRole.PARTY_GOER); bool firstWealthyCoupleFound = false; for (int i = 0; i < players.Count; i++) { if (players[i].getRole() == EnumPlayerRole.WEALTHY_COUPLE) { if (!firstWealthyCoupleFound) { wealthyCouple1 = players[i]; firstWealthyCoupleFound = true; } else { wealthyCouple2 = players[i]; } } else if (players[i].getRole() == EnumPlayerRole.ASSASSIN) { assassin = players[i]; } } if (mTurnManagerScript.mCurrentRound == EnumCourse.ENTREE) { mRoleText.text += "\n" + assassin.getName().ToUpper() + " IS THE ASSASSIN." + "\nTHE WEALTHY COUPLE IS " + wealthyCouple1.getName().ToUpper() + "\nAND " + wealthyCouple2.getName().ToUpper() + "." + "\nCHOOSE WHO TO MARK."; SetButtonAction("MARK PLAYER", ShowMarkScreen); } else if (!isAssassinAlive()) { mRoleText.text += "\nTHE ASSASSIN IS OUT!" + "\nTHE WEALTHY COUPLE IS " + wealthyCouple1.getName().ToUpper() + "\nAND " + wealthyCouple2.getName().ToUpper() + "." + "\nCHOOSE WHO TO POISON."; SetButtonAction("POISON FOOD", delegate { ShowPoisonScreen(EnumPlayerRole.DISTANT_COUSIN); }); } else { mRoleText.text += "\n" + assassin.getName().ToUpper() + " IS THE ASSASSIN." + "\nTHE WEALTHY COUPLE IS " + wealthyCouple1.getName().ToUpper() + "\nAND " + wealthyCouple2.getName().ToUpper() + "." + "\nTRY TO HELP THE ASSASSIN DO THEIR JOB ;)"; SetButtonAction("GOT IT", OnConfirmButtonClicked); } break; case EnumPlayerRole.WEALTHY_COUPLE: for (int i = 0; i < players.Count; i++) { if (players[i].getRole() == EnumPlayerRole.WEALTHY_COUPLE && players[i] != players[mTurnManagerScript.GetCurrentPlayerIndex()]) { mRoleText.text += "\nYOUR PARTNER IS " + (players[i].getName()).ToUpper() + "." + "\nTAP THE BUTTON THREE TIMES TO CONTINUE."; } } SetButtonAction("GOT IT", OnConfirmButtonClicked); break; case EnumPlayerRole.PRIVATE_EYE: Player buggedPlayer = mRestaurantScript.getBuggedPlayer(); string saying; if (buggedPlayer == null) { saying = "\nTHE BUGGED MEAL DIDN'T PICK UP ON ANYTHING."; } else { saying = "\nYOU HAVE BUGGED " + (buggedPlayer.getName()).ToUpper() + "." + "\nTHEY ARE " + buggedPlayer.getRoleAsStringWithPrefix().ToUpper() + "."; mRestaurantScript.setBuggedPlayer(null); } switch (mTurnManagerScript.mCurrentRound) { case EnumCourse.ENTREE: mRoleText.text += "\nCHOOSE WHICH MEAL TO BUG."; SetButtonAction("BUG PLAYER", ShowBugScreen); break; case EnumCourse.MAIN: mRoleText.text += saying + "\nBUG A MEAL AGAIN."; SetButtonAction("BUG PLAYER", ShowBugScreen); break; case EnumCourse.DESSERT: mRoleText.text += saying; SetButtonAction("GOT IT", OnConfirmButtonClicked); break; } break; default: { mRoleText.text += "\nTAP THE BUTTON THREE TIMES TO CONTINUE."; SetButtonAction("GOT IT", OnConfirmButtonClicked); } break; } }