Example #1
0
		public void Apply(Player player, UnoCard card)
		{
			if (_canPlayCommand(player, card))
			{
				_playedCardSet.Push(card);
			}
		}
Example #2
0
		private bool CanPlayCommand(Player player, UnoCard card)
		{
			return (PlayerToPlay == player && (card.Id == Last.Id 
						|| card.Color == Last.Color
						|| card.IsWild))
						|| (card.Equals(Last));
		}
Example #3
0
		private void PlayCommand(Player player, UnoCard card)
		{
			foreach (var rule in _rules)
			{
				rule.Apply(player, card);				
			}		
		}
		private void ApplyRules(Player player, UnoCard card)
		{
			foreach (var rule in _cardBehaviourRules)
			{
				rule.Apply(player, card);
			}
		}
		public void Apply(Player player, UnoCard card)
		{
			int index = 0;
			while (index < _playedCardSet.Count && card.Equals(_playedCardSet.ElementAt(index)))
			{
				ApplyRules(player, card);
				index++;
			}			
		}
		public void Apply(Player player, UnoCard card)
		{
			_playedCardSet.Push(card);
		}
		public PlayOperation(Player player, Action<Player, UnoCard> playCommand, Func<Player, UnoCard, bool> canPlayCommand)
		{
			this.player = player;
			this.playCommand = playCommand;
			this.canPlayCommand = canPlayCommand;
		}
		public void Apply(Player player, UnoCard card)
		{
			if (card.Id == UnoCardId.Jump) turn.IncTurn();
		}