void CreateCardTypes() { for (int i = 0; i <= cards.Count / 2; i++) { CardGG c1 = cards[i]; CardGG c2 = cards[cards.Count - 1 - i]; // todo Put in true randomization, this only makes the last one the same as the first one and moves inward string type = GameSettings.Instance().GetRandomType(); c1.GenerateCard(type); c2.GenerateCard(type); } totalPoints = cards.Count / 2; }
public void SetCardsForMatch(CardGG card) { if (card1 == null) { card1 = card; state = BoardState.Flipping; } else { card2 = card; state = BoardState.Comparing; } MarkDirty(); }
private void Compare() { if (card1.cardType == card2.cardType) { numberOfCardsFlipped = 0; points++; if (totalPoints == points) { gameWon = true; } } else { card1.Unflip(); card2.Unflip(); } card1 = null; card2 = null; state = BoardState.Flipping; }