Exemplo n.º 1
0
    private void getCultureCards()
    {
        App    app    = UnityEngine.Object.FindObjectOfType <App>();
        Nation player = State.getNations()[app.GetHumanIndex()];

        PlayerPayer.payForCultureCard(player);
        MyEnum.cultCard newCard = PlayerReceiver.collectCultureCard(player);


        MyEnum.Era era = State.era;
        if (player.getNumberGood(MyEnum.Goods.paper) < 1 || player.getAP() < 1)
        {
            drawCultureCards.interactable = false;
        }
        if (era != MyEnum.Era.Late && player.getNumberResource(MyEnum.Resources.spice) < 1)
        {
            drawCultureCards.interactable = false;
        }
        if (era != MyEnum.Era.Early)
        {
            if (player.getNumberGood(MyEnum.Goods.clothing) < 1)
            {
                drawCultureCards.interactable = false;
            }
        }
        if (era == MyEnum.Era.Late && player.getNumberGood(MyEnum.Goods.telephone) < 1)
        {
            drawCultureCards.interactable = false;
        }
        Stack <CultureCard>   remainingCultCards = State.getCultureDeck();
        HashSet <CultureCard> cultDeckSet        = new HashSet <CultureCard>(remainingCultCards);

        List <MyEnum.cultCard> playerCultHand = new List <MyEnum.cultCard>(player.getCultureCards());
        HashSet <CultureCard>  playerCultSet  = new HashSet <CultureCard>(remainingCultCards);

        foreach (MyEnum.cultCard cardName in playerCultHand)
        {
            CultureCard card = State.getCultureCardByName(cardName);
            playerCultSet.Add(card);
        }


        if (cultDeckSet.IsSubsetOf(playerCultSet))
        {
            drawCultureCards.interactable = false;
        }
        AP.text = player.getAP().ToString();
        // numberCultureCards.text = player.getCultureCards().Count.ToString();
        cultureLevel.text = player.getCulureLevel().ToString();
        updateCultureCardBook(newCard);
        showCultureHandPanel();
    }