Exemplo n.º 1
0
 private void EvaluateEndGame()
 {
     if (_scores[Players.Top].Value == Goal && _scores[Players.Bottom].Value == Goal)
     {
         Debug.Log("Ending. Tied!");
     }
     else if (_scores[_currentPlayer].Value == Goal && NextPlayerState.Equals(PlayerFSMStates.Stand))
     {
         Debug.Log("Ending. Won by: " + _currentPlayer);
     }
     else if (CurrentPlayerState.Equals(PlayerFSMStates.Stand) && NextPlayerState.Equals(PlayerFSMStates.Stand))
     {
         DeclareWinnerForBestScore();
     }
     else if (TopSlots.MaxedOut && BottomSlots.MaxedOut)
     {
         DeclareWinnerForBestScore();
     }
 }
Exemplo n.º 2
0
 private void SwitchPlayers()
 {
     if (CurrentPlayerState.Equals(PlayerFSMStates.Stand) && NextPlayerState.Equals(PlayerFSMStates.Stand))
     {
         EvaluateEndGame();
     }
     else if (CurrentPlayerState.Equals(PlayerFSMStates.Stand))
     {
         _currentPlayer = NextPlayer;
         CurrentPlayerFsm.PerformTransition(PlayerFSMTransitions.PlayerTurn);
     }
     else if (NextPlayerState.Equals(PlayerFSMStates.Stand))
     {
         CurrentPlayerFsm.PerformTransition(PlayerFSMTransitions.PlayerTurn);
     }
     else
     {
         CurrentPlayerFsm.PerformTransition(PlayerFSMTransitions.PassControllToOtherPlayer);
         _currentPlayer = NextPlayer;
         CurrentPlayerFsm.PerformTransition(PlayerFSMTransitions.PlayerTurn);
     }
 }