예제 #1
0
        /// <summary>
        /// Reaction to be called when pointer-like input is released
        /// </summary>
        private void OnInputRelease()
        {
            if (currentDeckInputOver != null)
            {
                if (currentDeckInputOver.deckType == DeckController.DeckType.Column)
                {
                    //Check if the card added is one more greater than actual and if they are of the same seed
                    if (CheckIfCardMatch(currentDeckInputOver.GetTopCardValue(), draggedCard.GetValue(), true))
                    {
                        GameManager.I.MoveCtrl.RecordMove(0, draggedCard, draggedCardOriginalDeck, currentDeckInputOver);
                        //Assing 5 points from a card that come in column from outside
                        if (draggedCardOriginalDeck.deckType != DeckController.DeckType.Column)
                        {
                            AssignPoints(5);
                            GameManager.I.MoveCtrl.GetLastMove().PointsGiven = 5;
                        }

                        //Assign a move
                        AssignMove();

                        currentDeckInputOver.AddTopCard(draggedCard);
                        ReleaseDraggedCard(false);
                    }
                }
                else if (currentDeckInputOver.deckType == DeckController.DeckType.Seed)
                {
                    //Check if the card added is one less than actual and if they are of the same seed
                    if (CheckIfCardMatch(currentDeckInputOver.GetTopCardValue(), draggedCard.GetValue(), false))
                    {
                        //Assign 10 points for a card in the seed decks
                        AssignPoints(10);

                        GameManager.I.MoveCtrl.RecordMove(10, draggedCard, draggedCardOriginalDeck, currentDeckInputOver);

                        //Assign a move
                        AssignMove();

                        currentDeckInputOver.AddTopCard(draggedCard);
                        ReleaseDraggedCard(false);
                    }

                    //If won, show it
                    if (CheckVictory())
                    {
                        GameManager.I.InterfaceCtrl.DisplayVictoryMenu();
                    }
                }
            }

            ReleaseDraggedCard(true);
        }
예제 #2
0
 public Move(int _points, CardBehaviour _card, DeckController _initialDeck, DeckController _endingDeck)
 {
     PointsGiven = _points;
     Card        = _card;
     CardVal     = _card.GetValue();
     InitialDeck = _initialDeck;
     EndingDeck  = _endingDeck;
 }
예제 #3
0
        /// <summary>
        /// Add a card to the deck
        /// </summary>
        /// <param name="_newCard"></param>
        public void AddTopCard(CardBehaviour _newCard)
        {
            deck.Add(_newCard.GetValue());
            _newCard.transform.parent = transform;

            DisplayCard(_newCard, false);

            OrderCards();
        }
예제 #4
0
        /// <summary>
        /// Display a card on the top of the deck
        /// If _overrideLast == true, _card will be destroyed
        /// </summary>
        /// <param name="_card"></param>
        /// <param name="_overrideLast"></param>
        public void DisplayCard(CardBehaviour _card, bool _overrideLast)
        {
            if (_overrideLast && deckGraphic.Count > 0)
            {
                //Prevent override of nothing
                if (deckGraphic.Count == 0)
                {
                    DisplayCard(_card, false);
                    return;
                }

                deckGraphic.Last().SetValue(_card.GetValue());
                Destroy(_card.gameObject);
            }
            else
            {
                deckGraphic.Add(_card);
            }
        }