// Start turn public void StartTurn() { gameObject.SetActive(true); endTurnButton.interactable = false; // Show drawn card Card drawnCard = player.StartTurn(); // Resource card if (drawnCard.cardType == CardType.Resource) { CardResourceDisplay newCardDisplay = (CardResourceDisplay)CardDisplay.CreateCardDisplay(drawnCard, drawnCardRegion); StartCoroutine(ShowDrawnCard(newCardDisplay)); } // Playable card else { CardPieceDisplay newCardDisplay = (CardPieceDisplay)CardDisplay.CreateCardDisplay(drawnCard, drawnCardRegion); newCardDisplay.player = player; StartCoroutine(ShowDrawnCard(newCardDisplay)); } // Update piece objects foreach (KeyValuePair <GamePiece, GamePieceObject> pair in gamePieceObjects) { if (pair.Key.hasActions) { pair.Value.ShowPieceDisabled(); } } }
public void InitializesCard() { Card card = LoadTestUnitCard(); Transform transform = new GameObject().transform; CardDisplay cardDisplay = CardDisplay.CreateCardDisplay(card, transform); Assert.IsNotNull(cardDisplay); Assert.AreEqual(cardDisplay.GetCard().cardName, "Wizard"); }
// Add card display public void AddCard(Card card) { if (card.cardType != CardType.Resource) { CardPieceDisplay newCardDisplay = (CardPieceDisplay)CardDisplay.CreateCardDisplay(card, cardRegion); newCardDisplay.player = player; cards.Add(newCardDisplay); ShowPlayableCard(newCardDisplay); } }
// Show card display public void ShowCardDisplay(Card card) { try { // Do nothing if the card is the same if (currentCardDisplay.GetCard() == card) { return; } // Create a new card Destroy(currentCardDisplay.gameObject); currentCardDisplay = CardDisplay.CreateCardDisplay(card, cardDisplayPanel); } catch { // Create a new card currentCardDisplay = CardDisplay.CreateCardDisplay(card, cardDisplayPanel); } }
// Add a card to the hand public void AddCard(Card card) { if (card != null) { CardDisplay newCardDisplay = CardDisplay.CreateCardDisplay(card, drawnCardRegion); StartCoroutine(ShowDrawnCard(newCardDisplay)); // Increment resource if (card.cardType == CardType.Resource) { IncrementResource(card.res1, card.res1Cost); playerUI.UpdateAllResources(resources); SetPlayableCards(); } // Add card piece display else { cardPieceDisplays.Add((CardPieceDisplay)newCardDisplay); newCardDisplay.player = this; SetPlayable((CardPieceDisplay)newCardDisplay); } } }