예제 #1
0
 /// <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);
     }
 }
예제 #2
0
        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);
            }
        }
예제 #3
0
 /// <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);
 }