/// <summary> /// Maoves card from table to destryedCards[] /// </summary> /// <param card you want to remove="card"></param> /// <param its position on the table="cardPosition"></param> public void DestroyCard(Card card, CardPosition cardPosition) { // Remove cardArray[cardPosition.row] = HelperFunctions.RemoveAtIndex <Card>(cardArray[cardPosition.row], cardPosition.column); // Add to destroyedCards[] destroyedCards = HelperFunctions.AddAfter <Card>(destroyedCards, card, destroyedCards.Length - 1); }
protected Card GetRandomCardFromHand() { int index = UnityEngine.Random.Range(0, playerCards.Length); Card card = playerCards[index]; playerCards = HelperFunctions.RemoveAtIndex <Card>(playerCards, index); numberOfPlayerCardsInHand--; return(card); }
/// <summary> /// Removes specified card from hand and returns the specified card. /// </summary> /// <returns>returns player card with specified index from hand</returns> public Card GetCard(int cardIndex) { for (int i = 0; i < playerCards.Length; i++) { Card result = playerCards[i]; if (result.cardIndex == cardIndex) { playerCards = HelperFunctions.RemoveAtIndex <Card>(playerCards, i); return(result); } } throw new Exception("Card not found! card number: " + cardIndex); }