public void SetHighCard(GameData gameState) { if (highCard != null) { GameObject.Destroy(highCard.gameObject); highCard = null; HighCardPlayerName.text = string.Empty; } PlayerData turnLeader = gameState.TurnLeader; if (turnLeader != null) { highCard = CardView.CreateFromModel(turnLeader.CurrentRoundCard, HighCardContainer); HighCardPlayerName.text = turnLeader.PlayerName; } if (lastCard != null) { GameObject.Destroy(lastCard.gameObject); lastCard = null; } PlayerData lastPlayer = gameState.LastPlayer; if (lastPlayer != null) { lastCard = CardView.CreateFromModel(lastPlayer.CurrentRoundCard, LastPlayedCardContainer); } }
private void SetTrumpCard(GameData gameState) { if (trumpCard != null) { GameObject.Destroy(trumpCard.gameObject); trumpCard = null; } Debug.Log("Trump card set to " + gameState.CurrentTrumpCard.ToString()); trumpCard = CardView.CreateFromModel(gameState.CurrentTrumpCard, TrumpCardContainer); }
public void SetPlayerHand(List <Card> hand, bool allowAutoPlay, Card autoPlayCard, GameData gameState, PlayerData localPlayer) { for (int i = 0, count = playerHand.Count; i < count; ++i) { GameObject.Destroy(playerHand[i].gameObject); } playerHand.Clear(); for (int i = 0, count = hand.Count; i < count; ++i) { Card card = hand[i]; bool allowAutoPlayCard = allowAutoPlay && gameState.IsCardValid(card, localPlayer, true); playerHand.Add(CardView.CreateFromModel(card, YourHandContainer, true, allowAutoPlayCard, autoPlayCard)); } }