Beispiel #1
0
 public void ExecuteAction(AGameTurn gameTurn)
 {
     if (_currentGame.CanBePlayed(gameTurn))
     {
         _currentGame.Play(gameTurn);
     }
     else
     {
         Debug.LogWarning("Can not play gameTurn " + gameTurn.GetType());
     }
 }
Beispiel #2
0
        public bool Play(AGameTurn action)
        {
            if (DiceGameState == DiceGameStates.Running && ((!(action is RerollTurn) || _currentBoard.IsRerollPossible()) && action.ValidateGameAction(this)))
            {
                action.PlayGameAction(this);
                CurrentBoard.CheckInstantRules(this);
                CheckRoundEnd();
                CheckGameEnd();
                if (_diceGameState == DiceGameStates.Running)
                {
                    ActionEndedEvent?.Invoke(new GameTurnEndedEventArgs(this, action));
                }

                return(true);
            }

            return(false);
        }
Beispiel #3
0
 public GameTurnEndedEventArgs(DiceGame diceGame, AGameTurn gameTurn)
 {
     DiceGame = diceGame;
     GameTurn = gameTurn;
 }
Beispiel #4
0
 public bool CanBePlayed(AGameTurn action)
 {
     return(action.ValidateGameAction(this));
 }