// Show current player's turn public IEnumerator ShowDrawnCard(CardDisplay cardDisplay) { Card card = cardDisplay.GetCard(); cardDisplay.SetIsDrawn(); yield return(new WaitForSeconds(2)); // Increment resource if (card.cardType == CardType.Resource) { C.Destroy(cardDisplay.gameObject); } // Add card piece display else { int newCardIndex = (handTransform.childCount + 1) / 2; cardDisplay.transform.SetParent(handTransform); cardDisplay.transform.SetSiblingIndex(newCardIndex); } // Remove new turn display and enable end turn button //currentTurnText.transform.parent.gameObject.SetActive(false); //endTurnButton.interactable = true; }
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"); }
// 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); } }
// Show current player's turn public IEnumerator ShowDrawnCard(CardDisplay cardDisplay) { cardDisplay.SetIsDrawn(); yield return(new WaitForSeconds(2)); // Add non-resource cards to hand if (cardDisplay.GetCard().cardType != CardType.Resource) { handObject.AddDrawnCard((CardPieceDisplay)cardDisplay); } else { Destroy(cardDisplay.gameObject); resourceCounter.UpdateAllResources(player.GetResources()); } // Remove new turn display and enable end turn button currentTurnText.transform.parent.gameObject.SetActive(false); endTurnButton.interactable = true; }
public void OnPointerClick(PointerEventData eventData) { gm.PrepareCard(cardDisplay.GetCard()); }