public void LoadCard(CardData cardData) { Card card = new Card(cardData); GameObject display = Instantiate(cardDisplayPrefab, cardDisplayArea.transform) as GameObject; CardDisplaySmall displayInfo = display.GetComponent <CardDisplaySmall>(); displayInfo.SetCard(card); displayInfo.SetSelectable(cardsAreSelectable); }
public void DisplayCard(CardDisplaySmall cardDisplay) { foreach (Transform child in transform) { GameObject.Destroy(child.gameObject); } cardDisplay.transform.SetParent(this.transform.parent); cardDisplay.transform.position = this.transform.position; }
public void AddToDiscardDisplay(Card card) { GameObject cardDisplay = Instantiate(smallCardDisplayPrefab) as GameObject; cardDisplay.transform.SetParent(discardedCardsDisplay.transform); CardDisplaySmall displayInfo = cardDisplay.GetComponent <CardDisplaySmall>(); displayInfo.card = card; }
public void AddCardToHandDisplay(Card card) { GameObject cardDisplay = Instantiate(cardInHandDisplayPrefab) as GameObject; cardDisplay.transform.SetParent(playerHandDisplay.transform); CardDisplaySmall displayInfo = cardDisplay.GetComponent <CardDisplaySmall>(); displayInfo.card = card; }
public List <CardDisplaySmall> GetCardDisplays() { List <CardDisplaySmall> cards = new List <CardDisplaySmall>(); foreach (Transform child in cardDisplayArea.transform) { CardDisplaySmall cardDisplay = child.gameObject.GetComponent <CardDisplaySmall>(); if (cardDisplay) { cards.Add(cardDisplay); } } return(cards); }
public void OnDrop(PointerEventData eventData) { Draggable droppedObj = eventData.pointerDrag.GetComponent <Draggable>(); if (droppedObj) { droppedObj.parentToReturnTo = this.transform; CardDisplaySmall cardObj = eventData.pointerDrag.GetComponent <CardDisplaySmall>(); if (cardObj) { gameController.PlayCard(gameController.GetLocalPlayer(), cardObj.card); DisplayCard(cardObj); } } }
public void DisplayOpponentCards(GamePlayer opponent, Table table, int opponentIndex) { foreach (Transform child in opponentCardDisplay.transform) { GameObject.Destroy(child.gameObject); } Image background = opponentCardDisplay.GetComponent <Image>(); background.color = opponent.Colour; GameController game = GetComponent <GameController>(); Card[] opponentCards = table.GetCardsByPlayer(opponentIndex); foreach (Card card in opponentCards) { GameObject cardDisplay = Instantiate(smallCardDisplayPrefab) as GameObject; cardDisplay.transform.SetParent(opponentCardDisplay.transform); CardDisplaySmall displayInfo = cardDisplay.GetComponent <CardDisplaySmall>(); displayInfo.card = card; } }