예제 #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);
    }
예제 #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;
 }
예제 #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;
    }
예제 #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;
    }
예제 #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);
    }
예제 #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);
            }
        }
    }
예제 #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;
        }
    }