public void DiscardCard(int discarded) { try { var cardInd = CardsInHand.FindIndex(c => c.CardId == discarded); if (cardInd >= 0) { CardsInHand.RemoveAt(cardInd); } if (CardsInHand.Count == 2) { RoundState = RoundState.ChancellorDiscard; } else if (CardsInHand.Count == 1) { } } catch (Exception ex) { Console.WriteLine("DiscardCard.ex :" + ex.Message); } }
public void ConsumeActiveCard() { /* * MyAudioSource.pitch = Random.Range(.95f, 1.05f); * MyAudioSource.clip = CardPlacedSound; * MyAudioSource.Play(); */ ResourceCard removedCard = GetActiveCard(); CardsInHand.RemoveAt(0); Destroy(removedCard.gameObject); if (CardsInHand.Count() == MaxHandSize) // we just went down to less than overflowing { HandIsNoLongerTooFullCallback(); } else if (CardsInHand.Count > 0) { MyAudioSource.clip = CardsInHand[0].RepresentedResource.ActiveCardSound; MyAudioSource.Play(); } AdjustCardsInHandPosition(); }