Esempio n. 1
0
    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);
    }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
    public void AddToDiscardDisplay(Card card)
    {
        GameObject cardDisplay = Instantiate(smallCardDisplayPrefab) as GameObject;

        cardDisplay.transform.SetParent(discardedCardsDisplay.transform);

        CardDisplaySmall displayInfo = cardDisplay.GetComponent <CardDisplaySmall>();

        displayInfo.card = card;
    }
Esempio n. 4
0
    public void AddCardToHandDisplay(Card card)
    {
        GameObject cardDisplay = Instantiate(cardInHandDisplayPrefab) as GameObject;

        cardDisplay.transform.SetParent(playerHandDisplay.transform);

        CardDisplaySmall displayInfo = cardDisplay.GetComponent <CardDisplaySmall>();

        displayInfo.card = card;
    }
Esempio n. 5
0
    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);
    }
Esempio n. 6
0
    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);
            }
        }
    }
Esempio n. 7
0
    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;
        }
    }