Ejemplo n.º 1
0
 private void InitializeGameplay()
 {
     // Create 10 cards for your deck
     for (int count = 0; count < 10; ++count)
     {
         // Create new card and add it to the Deck
         GameObject newCard = MakeCard();
         mDeck.AddCardToDeck(newCard);
     }
 }
Ejemplo n.º 2
0
    public IEnumerator PlayCard(GameObject pCard)
    {
        // Get the card_data
        Card_Data tCardData = pCard.GetComponent <CardController> ().Card;

        // Remove the card from the hand
        CardsInHand.Remove(pCard);

        // Pay the cost of the card
        Player.PayManaCost(tCardData.manaCost);

        // TODO Check effects that activate on card activation

        // Toss the card template back to factory
        StartCoroutine(MatchHelper.RecycleCardTemplate(pCard));

        // Set card being play
        CardBeingPlay = tCardData;

        // Get all the effects of the card
        List <_Effect> tEffects = pCard.GetComponent <CardController>().GetEffects();

        // Resolve the card effects
        for (int i = 0; i < tEffects.Count; i++)
        {
            string        Result;
            CoroutineData EffectCoroutine = new CoroutineData(this, tEffects [i].ResolveEffect());

            yield return(EffectCoroutine.coroutine);

            Result = null;
            Result = (string)EffectCoroutine.result;

            yield return(new WaitUntil(() => Result == "Finished"));
        }

        // Decrement card_data charge
        tCardData.charge--;
        Debug.Log("Charge: " + tCardData.charge);

        // Put the card back into the deck or discard pile
        if (tCardData.charge > 0)
        {
            Deck.AddCardToDeck(tCardData);
        }
        else
        {
            DiscardPile.Add(tCardData);
        }

        AlignHand();
        CardBeingPlay = null;
        yield return("Finished");
    }
Ejemplo n.º 3
0
    private void InitializeGameplay()
    {
        // Create cards for your starter deck
        Queue <GameObject> newDeck2 = new Queue <GameObject>();

        // Make 5 each Run-1
        int numRunLevel1 = 5;

        for (int c = 1; c <= numRunLevel1; ++c)
        {
            newDeck2.Enqueue(MakeCard(CardType.RunLeft, 1));
        }
        for (int c = 1; c <= numRunLevel1; ++c)
        {
            newDeck2.Enqueue(MakeCard(CardType.RunRight, 1));
        }

        // Make 2 each Run-2
        int numRunLevel2 = 5;

        for (int c = 1; c <= numRunLevel2; ++c)
        {
            newDeck2.Enqueue(MakeCard(CardType.RunLeft, 2));
        }
        for (int c = 1; c <= numRunLevel2; ++c)
        {
            newDeck2.Enqueue(MakeCard(CardType.RunRight, 2));
        }

        // Make 1 each Run-3
        int numRunLevel3 = 1;

        for (int c = 1; c <= numRunLevel3; ++c)
        {
            newDeck2.Enqueue(MakeCard(CardType.RunLeft, 3));
        }
        for (int c = 1; c <= numRunLevel3; ++c)
        {
            newDeck2.Enqueue(MakeCard(CardType.RunRight, 3));
        }

        // Make 5 Jump-Low
        int numJumpLow = 5;

        for (int c = 1; c <= numJumpLow; ++c)
        {
            newDeck2.Enqueue(MakeCard(CardType.JumpLow, 1));
        }
        // Make 2 Jump-High
        int numJumpHigh = 5;

        for (int c = 1; c <= numJumpHigh; ++c)
        {
            newDeck2.Enqueue(MakeCard(CardType.JumpHigh, 1));
        }

        while (newDeck2.Count > 0)
        {
            mDeck.AddCardToDeck(newDeck2.Dequeue());
        }
        mDeck.ShuffleDeck();
    }