public void CloseRevealedCards() { var cards = GetRevealedCards(); foreach (var card in cards) { card.Status = CardStatus.Closed; } GameFieldChanged.SafeInvoke(this, new EventArgs()); }
public void CreateMatch(Tuple <ICard, ICard> pairedCards) { foreach (var card in new[] { pairedCards.Item1, pairedCards.Item2 }) { if (!Cards.Contains(card)) { throw new InvalidOperationException(); } card.Status = CardStatus.Removed; } GameFieldChanged.SafeInvoke(this, new EventArgs()); }
public void RevealCard(ICard card) { if (card.Status == CardStatus.Revealed) { return; } var revealedCards = GetRevealedCards(); if (revealedCards.Count() == 2) { CloseRevealedCards(); } card.Status = CardStatus.Revealed; GameFieldChanged.SafeInvoke(this, new EventArgs()); }
private void _gameField_GameFieldChanged(object sender, EventArgs e) { GameFieldChanged.SafeInvoke(sender, e); }
public void RemoveCard(ICard card) { card.Status = CardStatus.Removed; GameFieldChanged.SafeInvoke(this, new EventArgs()); }