コード例 #1
0
    public void BuyCard(CardStack cardStack)
    {
        Card card = cardStack.Peek();

        Debug.Log("Attempting to buy card " + card.name);
        if (card.Cost <= money && buys > 0)
        {
            guiManager.ChangeMode(new BuyMode(this));
            Debug.Log("Actually buying it.");
            rubbishStack.Push(cardStack.Pop());
            buys--;
            money -= card.Cost;
        }
    }
コード例 #2
0
    private const float DELAY = 0.0001f;     // TMP: was 0.15f

    // Use this for initialization
    private IEnumerator Start()
    {
        //Initialize the base stack first thing.
        //		CardStack big_stack = new CardStack(AbsolutePosition(3,3));
        string[] chosenCards = new string[]
        {
            "Adventurer", "Bureaucrat", "CouncilRoom", "Laboratory", "Festival", "Smithy", "Witch", "Cellar",
            "Chancellor", "Chapel"
        };
        for (int j = 0; j < chosenCards.Length; j++)
        {
            for (int i = 0; i < 10; i++)
            {
                bigStack.Push(CreateCard(chosenCards[j], "base"));
            }
        }

        for (int i = 0; i < 30; i++)
        {
            bigStack.Push(CreateCard("Curse", "base"));
        }
        for (int i = 0; i < 12; i++)
        {
            bigStack.Push(CreateCard("Province", "common"));
        }
        for (int i = 0; i < 12; i++)
        {
            bigStack.Push(CreateCard("Duchy", "common"));
        }
        for (int i = 0; i < 24; i++)
        {
            bigStack.Push(CreateCard("Estate", "common"));
        }
        for (int i = 0; i < 30; i++)
        {
            bigStack.Push(CreateCard("Gold", "common"));
        }
        for (int i = 0; i < 40; i++)
        {
            bigStack.Push(CreateCard("Silver", "common"));
        }
        for (int i = 0; i < 60; i++)
        {
            bigStack.Push(CreateCard("Copper", "common"));
        }

        // Money, money, money
        for (int i = 0; i < 60; i++)
        {
            //yield return new WaitForSeconds(DELAY);
            copperStack.Push(bigStack.Pop());
        }
        for (int i = 0; i < 40; i++)
        {
            //yield return new WaitForSeconds(DELAY);
            silverStack.Push(bigStack.Pop());
        }
        for (int i = 0; i < 30; i++)
        {
            //yield return new WaitForSeconds(DELAY);
            goldStack.Push(bigStack.Pop());
        }

        cam.ChangeViewTo(Cam.Views.Hand);

        for (int i = 0; i < 24; i++)
        {
            //yield return new WaitForSeconds(DELAY);
            estateStack.Push(bigStack.Pop());
        }
        for (int i = 0; i < 12; i++)
        {
            //yield return new WaitForSeconds(DELAY);
            duchyStack.Push(bigStack.Pop());
        }
        for (int i = 0; i < 12; i++)
        {
            //yield return new WaitForSeconds(DELAY);
            provinceStack.Push(bigStack.Pop());
        }
        for (int i = 0; i < 30; i++)
        {
            //yield return new WaitForSeconds(DELAY);
            curseStack.Push(bigStack.Pop());
        }
        for (int i = 0; i < chosenCards.Length; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                //yield return new WaitForSeconds(DELAY);
                chosenCardStacks[i].Push(bigStack.Pop());
            }
        }

        // Build draw stack
        float tmpdelay = 0.25f;

        // TESTING

        /*
         * for (int i = 0; i < 5; i++)
         * {
         *  yield return new WaitForSeconds(tmpdelay);
         *  drawStack.Push(chosenCardStacks[0].Pop());
         * }
         */
        // END TESTING


        for (int i = 0; i < players.Length; i++)
        {
            for (int j = 0; j < 7; j++)
            {
                yield return(new WaitForSeconds(tmpdelay));

                players[i].drawStack.Push(copperStack.Pop());
            }
            for (int j = 0; j < 3; j++)
            {
                yield return(new WaitForSeconds(tmpdelay));

                players[i].drawStack.Push(estateStack.Pop());
            }
            yield return(StartCoroutine(drawStack.Shuffle()));

            yield return(StartCoroutine(players[i].hand.DrawNewCards(5)));
        }
        GuiManager.ChangeMode(new ActionMode(players[0]));
    }