Beispiel #1
0
    // Draws a card at nearest empty location to i
    IEnumerator DrawCard(int i)
    {
        if (i >= 0 && i < handSize && hand != null)
        {
            if (hand[i] != null)
            {
                if (hand[i].GetName() != "")
                {
                    yield return(RefreshAbilityPanel(i));

                    yield break;
                }
            }
            yield return(StartCoroutine(MoveAbilityPanel(cardPanels[i], DeckKey)));

            hand[i] = deck.Draw();
            curHandSize++;
            RefreshEntry(i);
            DeckPanel.Display(deck.Count);
            if (deck.Count < handSize)
            {
                DeckPanel.Display(0);
            }
            yield return(StartCoroutine(MoveAbilityPanel(cardPanels[i], GetCardKey(i))));

            SetDrawCooldown();
        }
    }
Beispiel #2
0
 public void Add(AbilityDeck ad)
 {
     while (ad.Count != 0)
     {
         Add(ad.Draw());
     }
 }
Beispiel #3
0
    // Connects player variables, draws first hand, shows hand panel
    public void ActivatePanel()
    {
        // Show hand panel to set up card panel positions
        handPanel.SetPosition(ShowKey, false);
        hidden = false;
        MatchScreen();

        // Lock panels beyond handsize, and properly display deck and graveyard panels
        for (int i = handSize; i < cardPanels.Count; i++)
        {
            cardPanels[i].IsLocked = true;
        }
        DiscardPanel.Display(0);
        DeckPanel.Display(0);

        // Hide hand until activation
        handPanel.SetPosition(HideKey, false);

        SetDrawCooldown();

        // Set up (connect) deck, and hand variables with player
        if (owner.playerUnit.hand == null)
        {
            owner.playerUnit.hand = new List <Card>(MaxHandSize);
        }
        hand        = owner.playerUnit.hand;
        discards    = owner.playerUnit.discards;
        deck        = owner.playerUnit.deck;
        handSize    = owner.playerUnit.handSize;
        curHandSize = handSize;

        // Draw hand
        for (int i = hand.Count - 1; i < MaxHandSize; ++i)
        {
            if (i >= curHandSize)
            {
                if (!cardPanels[i].IsLocked)
                {
                    cardPanels[i].IsLocked = true;
                }
                cardPanels[i].card = EmptyCard();
            }
            else
            {
                deck.Shuffle();
                hand.Add(deck.Draw());
            }

            RefreshEntry(i);
        }

        DeckPanel.Display(deck.Count);
        SetSelection(0);
        SetDrawCooldown();

        handPanel.SetPosition(ShowKey, true);
        hidden = false;
    }
Beispiel #4
0
 void Start()
 {
     owner = GetComponentInParent <Unit>();
     if (owner.hand == null)
     {
         owner.hand = new List <Card>();
     }
     deck = owner.deck;
     hand = owner.hand;
     while (hand.Count < 4)
     {
         hand.Add(deck.Draw());
     }
 }
    public void DrawCardFromLibrary()
    {
        AbilityDeck library = GetDeck(AbilityDeck.DeckType.Library);

        AbilityCard targetCard = library.Draw();

        if (targetCard == null)
        {
            //Debug.Log("Library is empty");
            return;
        }

        //Debug.Log(targetCard.cardName + " is being drawn ");
        //Debug.Log(library + " is my lbrary");

        library.TransferCard(targetCard, AbilityDeck.DeckType.Hand);

        //MainHUD.SetPlayerSlot(targetCard);
    }
    public virtual void Draw()
    {
        if (Hand.Count < CurrentHandSize)
        {
            AbilityCard newCard = AbilityDeck.Draw(DeckPosition.Top);
            if (newCard != null)
            {
                Hand.Add(newCard, DeckPosition.Top);

                RaiseHand(Hand);
                RaiseMain(AbilityDeck);
            }
            if (AbilityDeck.Count == 0)
            {
                ReshuffleDiscard();
            }
        }
        else
        {
            // draw fail feedback
        }
    }