示例#1
0
        private void CardHasBeenPlayed(Card cardPlayedAs, int count)
        {
            Card cardAfterPlay = this.cardsBeingPlayed.DrawCardFromTop();
            if (cardAfterPlay != null)
            {
                if (cardAfterPlay.isDuration)
                {
                    this.durationCards.AddCard(cardAfterPlay);
                    for (int i = 1; i < count; ++i)
                    {
                        this.actionsToExecuteAtBeginningOfNextTurn.Add(delegate(PlayerState currentPlayer, GameState gameState)
                        {
                            gameState.cardContextStack.PushCardContext(this, cardPlayedAs, CardContextReason.CardFinishingDuration);
                            cardPlayedAs.DoSpecializedDurationActionAtBeginningOfTurn(currentPlayer, gameState);
                            gameState.cardContextStack.Pop();
                        });
                    }
                }
                else
                {
                    this.cardsPlayed.AddCard(cardAfterPlay);
                }

                if (cardPlayedAs != cardAfterPlay && cardPlayedAs != null)
                {
                    if (cardPlayedAs.isDuration)
                    {
                        this.actionsToExecuteAtBeginningOfNextTurn.Add( delegate(PlayerState currentPlayer, GameState gameState)
                        {
                            gameState.cardContextStack.PushCardContext(this, cardPlayedAs, CardContextReason.CardFinishingDuration);
                            cardPlayedAs.DoSpecializedDurationActionAtBeginningOfTurn(currentPlayer, gameState);
                            gameState.cardContextStack.Pop();
                        });
                    }
                }
            }
        }