Beispiel #1
0
    IEnumerator DistributeHandCardsToAllPlayers()
    {
        PlayerBean dealerPlayer     = playersManager.getDealerPlayer();
        GameObject src              = dealerPlayer.getCardDeskObject();
        GameObject cardDeskPosition = dealerPlayer.getCardDeskPositionObject();

        cardDeskPosition.SetActive(true);
        src.SetActive(true);
        int i = 0;

        while (i < playersManager.getAllPlayers().Count)
        {
            PlayerBean player   = playersManager.getAllPlayers() [i];
            GameObject card1Obj = player.getCard1Object();
            GameObject card2Obj = player.getCard2Object();
            src.transform.position = cardDeskPosition.transform.position;
            animationManager.MoveCardsObject(src, card1Obj);
            yield return(new WaitForSeconds(GameConstant.ANIM_CARD_TIME));

            card1Obj.SetActive(true);

            src.transform.position = cardDeskPosition.transform.position;
            animationManager.MoveCardsObject(src, card2Obj);
            yield return(new WaitForSeconds(GameConstant.ANIM_CARD_TIME));

            card2Obj.SetActive(true);
            i++;
        }
        dealerPlayer.getCardDeskObject().SetActive(false);
        cardDeskPosition.SetActive(false);
        src.transform.position = cardDeskPosition.transform.position;

        startGameRequest();
    }
    IEnumerator DistributeHandCardsToAllPlayers()
    {
        PlayerBean dealerPlayer     = playersManager.getDealerPlayer();
        GameObject src              = dealerPlayer.getCardDeskObject();
        GameObject cardDeskPosition = dealerPlayer.getCardDeskPositionObject();

        cardDeskPosition.SetActive(true);
        src.SetActive(true);
        int i = 0;

        while (i < playersManager.getAllPlayers().Count)
        {
            PlayerBean player = playersManager.getAllPlayers() [i];
//			DEBUG.Log ("Name : "+ player.getPlayerName()+" >> "+player.isWaitingForGame()+" >> "+ player.isFoldedPlayer());
            if (!player.isWaitingForGame())
            {
//				DEBUG.Log ("Name : "+ player.getPlayerName()+" >< ");
                GameObject card1Obj = player.getCard1Object();
                GameObject card2Obj = player.getCard2Object();
                src.transform.position = cardDeskPosition.transform.position;
                animationManager.MoveCardsObject(src, card1Obj);
                yield return(new WaitForSeconds(GameConstant.ANIM_CARD_TIME));

                card1Obj.SetActive(true);

                src.transform.position = cardDeskPosition.transform.position;
                animationManager.MoveCardsObject(src, card2Obj);
                yield return(new WaitForSeconds(GameConstant.ANIM_CARD_TIME));

                card2Obj.SetActive(true);
            }
            else
            {
                DEBUG.Log("Name : " + player.getPlayerName());
            }
            i++;
        }
        dealerPlayer.getCardDeskObject().SetActive(false);
        cardDeskPosition.SetActive(false);
        src.transform.position = cardDeskPosition.transform.position;
    }