Exemple #1
0
    private IEnumerator PlayerTurn()
    {
        hand.Clear();
        if (deck.Count == 0)
        {
            yield return(StartCoroutine(ReplenishDeck()));

            Buff b;
            b.name         = "시간의 강화";
            b.icon         = BuffIcon.DamageUp;
            b.cannotAttack = false;
            b.confused     = false;
            b.deltaDamage  = 1;
            b.deltaDefence = 0;
            b.deltaEvasion = 5;
            b.duration     = -1;
            b.turnstamp    = -1;
            Buff(b, RandomEnemy());
            while (isAnimating)
            {
                yield return(null);
            }
        }
        for (int i = 0; i < 3; i++)
        {
            int c = deck[Random.Range(0, deck.Count)];
            hand.Add(c);
            deck.Remove(c);
        }
        UIManager.UpdateDeckCount(deck.Count);

        yield return(StartCoroutine(UIManager.GetInstance().PlayerCardChoice(hand)));

        bool call_YS;
        int  cardid = UIManager.GetChosenCard(out call_YS);

        if (!call_YS)
        {
            if (cardid != -1)
            {
                ICard card         = CardIndexManager.GetCardByID(cardid);
                int   target_count = card.GetTargetCount();
                if (target_count > 0)
                {
                    if (enemies.Count > target_count)
                    {
                        yield return(StartCoroutine(UIManager.PlayerCardTargetChoice(target_count)));

                        Character[] targets = UIManager.GetChosenTarget();
                        card.ResolveEffect(this, targets);
                    }
                    else
                    {
                        card.ResolveEffect(this, AllEnemy());
                    }
                    while (isAnimating)
                    {
                        yield return(null);
                    }
                    prayPool.AddRange(card.GetPray());
                }
                else
                {
                    card.ResolveEffect(this, null);
                    while (isAnimating)
                    {
                        yield return(null);
                    }
                    prayPool.AddRange(card.GetPray());
                }
                prayStack++;
                if (prayStack > 5)
                {
                    prayStack = 5;
                }
                UIManager.UpdateYoggStack(prayStack);
            }
        }
        else
        {
            yield return(StartCoroutine(CallYS()));
        }
    }
 void Awake()
 {
     instance = this;
 }