public override string ToString() { return("Team Color: " + teamColor.ToString() + ", CardIndex: " + cardIndex.ToString()); }
void HandleRevealCardResolution(RevealCardResolutions revealResolution, CardColor teamColor) { switch (revealResolution) { case RevealCardResolutions.PASS: Debug.Log("Team passed turn"); if (teamColor == CardColor.Blue) { EventManager.onGameStateApiDone.Invoke(GameState.BLUE_TEAM_TURN_END); } else if (teamColor == CardColor.Red) { EventManager.onGameStateApiDone.Invoke(GameState.RED_TEAM_TURN_END); } else { throw new System.InvalidOperationException("A team must be blue or red"); } break; case RevealCardResolutions.ALREADY_REVEALED: Debug.Log("Ignored Submission. Already revealed card was chosen"); break; case RevealCardResolutions.REVEALED_BLACK_TEAM_CARD: Debug.Log("Black card revealed! " + teamColor.ToString() + " team loses the game"); if (teamColor == CardColor.Blue) { EventManager.onGameStateApiDone.Invoke(GameState.RED_TEAM_WINS); } else if (teamColor == CardColor.Red) { EventManager.onGameStateApiDone.Invoke(GameState.BLUE_TEAM_WINS); } else { throw new System.InvalidOperationException("A team must be blue or red"); } break; case RevealCardResolutions.REVEALED_BROWN_TEAM_CARD: Debug.Log("Brown card revealed! " + teamColor.ToString() + " team loses their turn"); if (teamColor == CardColor.Blue) { EventManager.onGameStateApiDone.Invoke(GameState.BLUE_TEAM_TURN_END); } else if (teamColor == CardColor.Red) { EventManager.onGameStateApiDone.Invoke(GameState.RED_TEAM_TURN_END); } else { throw new System.InvalidOperationException("A team must be blue or red"); } break; case RevealCardResolutions.REVEALED_BLUE_TEAM_CARD: guessesLeft -= 1; CardsToWinTeamBlue -= 1; PrintScore(); if (CardsToWinTeamBlue == 0) { EventManager.onGameStateApiDone.Invoke(GameState.BLUE_TEAM_WINS); } else { if (teamColor == CardColor.Blue) { if (guessesLeft == 0) { EventManager.onGameStateApiDone.Invoke(GameState.BLUE_TEAM_TURN_NO_MORE_GUESSES); } else { Debug.Log("Blue card revealed! Team continues. Guesses left: " + guessesLeft.ToString()); EventManager.onGameStateApiDone.Invoke(GameState.BLUE_TEAM_TURN_CONTINUE); } } else if (teamColor == CardColor.Red) { Debug.Log("Blue card revealed! " + teamColor.ToString() + " team loses their turn"); EventManager.onGameStateApiDone.Invoke(GameState.RED_TEAM_TURN_END); } else { throw new System.InvalidOperationException("A team must be blue or red"); } } break; case RevealCardResolutions.REVEALED_RED_TEAM_CARD: guessesLeft -= 1; CardsToWinTeamRed -= 1; PrintScore(); if (CardsToWinTeamRed == 0) { EventManager.onGameStateApiDone.Invoke(GameState.RED_TEAM_WINS); } else { if (teamColor == CardColor.Blue) { Debug.Log("Red card revealed! " + teamColor.ToString() + " team loses their turn"); EventManager.onGameStateApiDone.Invoke(GameState.BLUE_TEAM_TURN_END); } else if (teamColor == CardColor.Red) { if (guessesLeft == 0) { EventManager.onGameStateApiDone.Invoke(GameState.RED_TEAM_TURN_NO_MORE_GUESSES); } else { Debug.Log("Red card revealed! Team continues. Guesses left: " + guessesLeft.ToString()); EventManager.onGameStateApiDone.Invoke(GameState.RED_TEAM_TURN_CONTINUE); } } else { throw new System.InvalidOperationException("A team must be blue or red"); } } break; default: throw new System.NotImplementedException("RevealCardResolutions not implemented: " + revealResolution.ToString()); } }
public override string ToString() { return(team.ToString() + ": " + word + ", " + number.ToString()); }