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(); }
public IEnumerator openFirstFlopCards() { if (!gameObject.transform.Find(GameConstant.UI_PATH_FIRST_FLOP).gameObject.activeSelf) { cardDesk = dealerPlayer.getCardDeskObject(); cardDeskPosition = dealerPlayer.getCardDeskPositionObject(); cardDeskPosition.SetActive(true); cardDesk.SetActive(true); gameObject.transform.Find(GameConstant.UI_PATH_FIRST_FLOP).gameObject.SetActive(true); Image card1 = gameObject.transform.Find(GameConstant.UI_PATH_FIRST_FLOP + GameConstant.UI_PATH_CARD_1).GetComponent <Image> (); Image card2 = gameObject.transform.Find(GameConstant.UI_PATH_FIRST_FLOP + GameConstant.UI_PATH_CARD_2).GetComponent <Image> (); card1.gameObject.SetActive(false); card2.gameObject.SetActive(false); cardDesk.transform.position = cardDeskPosition.transform.position; cardAnimationManager.MoveCardsObject(cardDesk, card1.gameObject); yield return(new WaitForSeconds(GameConstant.ANIM_CARD_TIME)); card1.gameObject.SetActive(true); cardDesk.transform.position = cardDeskPosition.transform.position; cardAnimationManager.MoveCardsObject(cardDesk, card2.gameObject); yield return(new WaitForSeconds(GameConstant.ANIM_CARD_TIME)); card2.gameObject.SetActive(true); card1.sprite = firstFlop1.getCardSprite(); card2.sprite = firstFlop2.getCardSprite(); cardDesk.SetActive(false); cardDeskPosition.SetActive(false); } }
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; }
public IEnumerator managePlayerWACardAction(int action, PlayerBean playerBean) { PlayerBean dealerPlayer = playersManager.getDealerPlayer(); GameObject src = dealerPlayer.getCardDeskObject(); GameObject cardDeskPosition = dealerPlayer.getCardDeskPositionObject(); cardDeskPosition.SetActive(true); src.SetActive(true); src.transform.position = cardDeskPosition.transform.position; if (action == GameConstant.ACTION_WA_UP) { animationManager.MoveCardsObject(src, playerBean.getWACardUPObject()); yield return(new WaitForSeconds(GameConstant.ANIM_WAITING_TIME)); playerBean.upWACardBuy(); } else if (action == GameConstant.ACTION_WA_DOWN) { animationManager.MoveCardsObject(src, playerBean.getWACardDownObject()); yield return(new WaitForSeconds(GameConstant.ANIM_WAITING_TIME)); playerBean.downWACardBuy(); } }