示例#1
0
    private IEnumerator DistWhoopAssCard(int j, Transform card, Vector3 cardsFromPosition, Vector3 targetPos, WhoopAssPlayer player)
    {
        SoundManager.Instance.PlayCardSuffleSound(Camera.main.transform.position);

        float a = 0;

        while (a < 1)
        {
            a += 4 * Time.deltaTime;
            card.transform.position = Vector3.Lerp(cardsFromPosition, targetPos, a);

            yield return(0);
        }

        if (j == 0)
        {
            player.DestroyCard1();
        }
        else
        {
            player.DestroyCard2();
        }

        card.transform.SetParent(j == 0 ? player.card1Position : player.card2Position);

        if (player.playerID.Equals(NetworkManager.Instance.playerID))
        {
            card.GetComponent <CardFlipAnimation> ().PlayAnimation(j == 0 ? player.card1 : player.card2);
        }
    }
示例#2
0
    public void GenerateWhoopAssPlayerCardsForWaitingPlayer(bool destroyCards = true)
    {
        Vector3        cardsFromPosition = WhoopAssGame.Instance.playerPositions [0].position;
        WhoopAssPlayer dealerPlayer      = WhoopAssGame.Instance.GetDealerPlayer();

        if (dealerPlayer)
        {
            cardsFromPosition = dealerPlayer.transform.position;
        }

        for (int i = 0; i < WhoopAssGame.Instance.allWhoopAssPlayers.Count; i++)
        {
            WhoopAssPlayer p = WhoopAssGame.Instance.allWhoopAssPlayers [i];

            if (UIManager.Instance.isRegularTournament || UIManager.Instance.isSitNGoTournament)
            {
                if (p.playerInfo.Player_Status != (int)PLAYER_STATUS.ACTIVE &&
                    p.playerInfo.Player_Status != (int)PLAYER_STATUS.ABSENT &&
                    p.playerInfo.Player_Status != (int)PLAYER_STATUS.SIT_OUT &&
                    p.playerInfo.Player_Status != (int)PLAYER_ACTION.ALLIN &&
                    p.playerInfo.Player_Status != (int)PLAYER_STATUS.FOLDED &&
                    p.playerInfo.Player_Status != (int)PLAYER_ACTION.ACTION_FOLDED)
                {
                    continue;
                }
            }
            else
            {
                if (p.playerInfo.Player_Status != (int)PLAYER_STATUS.ACTIVE &&
                    p.playerInfo.Player_Status != (int)PLAYER_STATUS.ABSENT &&
                    p.playerInfo.Player_Status != (int)PLAYER_ACTION.ALLIN &&
                    p.playerInfo.Player_Status != (int)PLAYER_STATUS.FOLDED &&
                    p.playerInfo.Player_Status != (int)PLAYER_ACTION.ACTION_FOLDED)
                {
                    continue;
                }
            }

            for (int j = 0; j < 2; j++)
            {
                if (j == 0 && p.card1Position.childCount > 0 && p.playerID.Equals(NetworkManager.Instance.playerID))
                {
                    p.card1Position.GetChild(0).GetComponent <CardFlipAnimation> ().PlayAnimation(j == 0 ? p.card1 : p.card2);
                    continue;
                }
                if (j == 1 && p.card2Position.childCount > 0 && p.playerID.Equals(NetworkManager.Instance.playerID))
                {
                    p.card2Position.GetChild(0).GetComponent <CardFlipAnimation> ().PlayAnimation(j == 0 ? p.card1 : p.card2);
                    continue;
                }

                if (j == 0)
                {
                    p.DestroyCard1();
                }
                else
                {
                    p.DestroyCard2();
                }

//				if (WhoopAssGame.Instance.currentGameStatus == GAME_STATUS.CARD_DISTRIBUTE) {
//					GameObject card = Instantiate (whoopAssPlayerCardPrefab, cardsFromPosition, Quaternion.identity) as GameObject;
//					card.transform.SetParent (j == 0 ? p.card1Position : p.card2Position);
//					card.transform.localScale = Vector3.one;
//					if (p.playerID.Equals (NetworkManager.Instance.playerID))
//						card.GetComponent<CardFlipAnimation> ().DisplayCardWithoutAnimation (j == 0 ? p.card1 : p.card2);
//					StartCoroutine (MoveCardTo (card.transform, j == 0 ? p.card1Position.position : p.card2Position.position));
//				} else {
                Vector3    targetPos = j == 0 ? p.card1Position.position : p.card2Position.position;
                GameObject card      = Instantiate(whoopAssPlayerCardPrefab, targetPos, Quaternion.identity) as GameObject;
                card.transform.SetParent(j == 0 ? p.card1Position : p.card2Position);
                card.transform.localScale = Vector3.one;

                if (p.playerID.Equals(NetworkManager.Instance.playerID))
                {
                    card.GetComponent <CardFlipAnimation> ().DisplayCardWithoutAnimation(j == 0 ? p.card1 : p.card2);
                }
//				}
            }
        }
    }