コード例 #1
0
    public void ShowNewCards()
    {
        ResetCardSelectTimer();

        if (selectedCardUi != null)
        {
            selectedCardUi.UnHighlight();
            selectedCardUi = null;
        }

        currentCards.Clear();

        for (int i = 0; i < cardUis.Length; i++)
        {
            if (!CardCollection.Instance.HasCardsInPool())
            {
                CardCollection.Instance.FillCardPool();
            }

            Card card = CardCollection.Instance.GetRandomCardFromPool();

            int agreeCount = 0;
            for (int j = 0; j < allSheep.Count; j++)
            {
                Sheep p         = allSheep[j];
                float pIdealVal = p.Ideals.GetIdealValue(card.idealType);

                if (card.value > 0 && pIdealVal > 0)
                {
                    agreeCount++;
                }
                else if (card.value < 0 && pIdealVal < 0)
                {
                    agreeCount++;
                }
            }

            int agreePercent = (int)(((float)agreeCount / (float)allSheep.Count) * 100f);

            currentCards.Add(card);
            cardUis[i].SetCardDetails(card, agreePercent);
        }
    }