/// <summary> /// Invoked when the player's hand has gained a card /// </summary> /// <param name="sender">The object that invoked the event (the hand)</param> /// <param name="e">The card event arguments for the event</param> private void CardAdded(object sender, CardEventArgs e) { if (OnCardAddedToHand != null) { OnCardAddedToHand.Invoke(this, e.Card); } }
private void CardAddedOrRemoved(object sender, NotifyCollectionChangedEventArgs e) { var list = e.NewItems ?? e.OldItems; var card = list?[0] as Card; if (e.Action == NotifyCollectionChangedAction.Add) { OnCardAddedToHand?.Invoke(this, card); } if (e.Action == NotifyCollectionChangedAction.Remove) { OnCardRemovedFromHand?.Invoke(this, card); } }
/// <summary> /// Adds the card to the player's hand and triggers the OnCardAddedToHand event /// </summary> /// <param name="cardData"></param> public void AddCardToHand(Card card) { CurrentHand.Add(card); card.HandAnimationModule.Show(); OnCardAddedToHand?.Invoke(card); }