public void MoveToReleasedDeck(Player player, ReleasedDeck releasedDeck, int cardValue, Card card) { Card cardToRemoveFromPlayer = null; player.RemoveFromDisplayingCard(card); releasedDeck.ReceiveDisplayingCard(card); cardToRemoveFromPlayer = card; AddCardAnimation(card, releasedDeck.position); cardToRemoveFromPlayer = null; player.RepositionDisplayingCards(this); /* * int start = DisplayingCards.Count - 1; * int finish = DisplayingCards.Count - 1 - numberOfCard; * * List<Card> cardsToRemoveFromDeck = new List<Card>(); * * for (int i = start; i > finish; i--) * { * Card card = DisplayingCards[i]; * releasedDeck.ReceiveDisplayingCard(card); * cardsToRemoveFromDeck.Add(card); * AddCardAnimation(card, releasedDeck.position); * } * * foreach (Card card in cardsToRemoveFromDeck) * { * DisplayingCards.Remove(card); * }*/ }
public void DrawReleasedCard(Player player, ReleasedDeck releasedDeck, byte value) { int numberOfDisplayingCard = releasedDeck.ReleasedCards.Count; if (numberOfDisplayingCard > 0) { Card card = releasedDeck.ReleasedCards[numberOfDisplayingCard - 1]; card.SetCardValue(value); card.SetFaceUp(true); player.ReceiveDisplayingCard(card); AddCardAnimation(card, player.NextCardPosition()); releasedDeckCards.Remove(card); } }
private void Awake() { localPlayer = new Player(); localPlayer.PlayerId = "offline-player"; localPlayer.PlayerName = "Player"; localPlayer.Position = PlayerPositions[0].position; localPlayer.BookPosition = BookPositions[0].position; remotePlayer = new Player(); remotePlayer.PlayerId = "offline-bot"; remotePlayer.PlayerName = "Bot"; remotePlayer.Position = PlayerPositions[1].position; remotePlayer.BookPosition = BookPositions[1].position; remotePlayer.IsAI = true; releasedDeck = new ReleasedDeck(); releasedDeck.position = releasedDeckPos.position; cardAnimator = FindObjectOfType <CardAnimator>(); }
public void DealToReleasedDeck(ReleasedDeck releasedDeck, int numberOfCard) { int start = DisplayingCards.Count - 1; int finish = DisplayingCards.Count - 1 - numberOfCard; List <Card> cardsToRemoveFromDeck = new List <Card>(); for (int i = start; i > finish; i--) { Card card = DisplayingCards[i]; releasedDeck.ReceiveDisplayingCard(card); cardsToRemoveFromDeck.Add(card); AddCardAnimation(card, releasedDeck.position); } foreach (Card card in cardsToRemoveFromDeck) { DisplayingCards.Remove(card); } }