Esempio n. 1
0
    IEnumerator DrawWithAnimation(int drawnPlayer, int cardIndex, int turnPlayer)
    {
        get();
        cardName = "Card" + cardIndex;
        card     = GameObject.Find(cardName);
        moveFlag = true;
        yield return(new WaitForSeconds(0.5f));  //0.5秒待機

        moveFlag = false;
        int deleted = hands.FindDeletedPair(cardIndex, turnPlayer);

        if (deleted != 100)
        {
            flashFlag = true;   //アニメーション最中のアクション無効化用

            cardName = "Card" + deleted;
            card     = GameObject.Find(cardName);
            var color = card.GetComponent <SpriteRenderer>().color;
            color.a = 0;
            card.GetComponent <SpriteRenderer>().color = color;
            yield return(new WaitForSeconds(0.2f));

            color.a = 1f;
            card.GetComponent <SpriteRenderer>().color = color;
            yield return(new WaitForSeconds(0.2f));

            color.a = 0;
            card.GetComponent <SpriteRenderer>().color = color;
            yield return(new WaitForSeconds(0.2f));

            color.a = 1f;
            card.GetComponent <SpriteRenderer>().color = color;
            yield return(new WaitForSeconds(1f));

            record.updateRecordPaired(turn + 1, cardIndex, deleted); //棋譜操作
            record.updateInfoPaired(cardIndex, deleted);             //プライベート情報操作
            flashFlag = false;
        }
        else
        {
            record.updateRecordUnpaired(turn + 1, cardIndex, turnPlayer); //棋譜操作
            record.updateInfoUnpaired(turnPlayer, cardIndex);             //プライベート情報操作
        }

        hands.hands[dP].Remove(cardIndex); //引かれる人の手札配列からカードを削除
        hands.hands[tP].Add(cardIndex);    //引いた人の手札配列にカードを追加
        hands.DeletePair((cardIndex % 13) + 1, turnPlayer);
        hands.ClickUpdate();
        distribute = hand.GetComponent <Distribute>();
        distribute.updateField();
        turnManager.NextTurnPlayer();
        turnManager.NextDrawnPlayer();
        turnManager.turnNext(cardIndex);
        int deletedUniform;

        if (deleted == 100)
        {
            deletedUniform = -1;
        }
        else
        {
            deletedUniform = record.Uniform.IndexOf(deleted);
        }
        for (int cn = 0; cn < 3; cn++)
        {
            coms[cn].load(dP, record.Uniform.IndexOf(cardIndex), tP, deletedUniform);
        }
    }