Ejemplo n.º 1
0
        void AddPostEvents()
        {
            foreach (var cardTuple in _levelCards)
            {
                var card = cardTuple.Value;
                if (card.IsPostEventCard())
                {
                    var currentHappiness = ProcessCard.Instance().Happiness;
                    var currentMoney     = ProcessCard.Instance().Money;

                    if (card.right.happiness > 0 && currentHappiness <= card.right.happiness)
                    {
                        _postEventCards.Push(card);
                    }
                    else if (card.left.happiness > 0 && currentHappiness >= card.left.happiness)
                    {
                        _postEventCards.Push(card);
                    }
                    else if (card.right.money > 0 && currentMoney <= card.right.money)
                    {
                        _postEventCards.Push(card);
                    }
                    else if (card.left.money > 0 && currentMoney >= card.left.money)
                    {
                        _postEventCards.Push(card);
                    }
                }
            }

            shuffle(_postEventCards);
        }
Ejemplo n.º 2
0
 private CardDefinition obtainNextCard()
 {
     if (_currentEventState == EVENT_STATE.STATE_PRE_EVENT)
     {
         if (_preEventCards.Count > 0 && ProcessCard.Instance().Time < 28)
         {
             return(_preEventCards.Pop());
         }
         else
         {
             return(StartEvent());
         }
     }
     else if (_currentEventState == EVENT_STATE.STATE_EVENT)
     {
         if (_eventCards.Count > 0)
         {
             return(_eventCards.Pop());
         }
         else
         {
             return(StartPostEvent());
         }
     }
     else if (_currentEventState == EVENT_STATE.STATE_POST_EVENT)
     {
         if (_postEventCards.Count > 0)
         {
             return(_postEventCards.Pop());
         }
         else
         {
             return(StartLevel());
         }
     }
     else if (_currentEventState == EVENT_STATE.STATE_INIT)
     {
         return(StartLevel());
     }
     else if (_currentEventState == EVENT_STATE.STATE_LEVEL)
     {
         ProcessCard.Instance().Reset();
         LoadLevel();
         return(obtainNextCard());
     }
     else
     {
         ProcessCard.Instance().Reset();
         LoadLevel();
         return(obtainNextCard());
     }
 }