Esempio n. 1
0
        /**
         * Take all cards from talon and put them back in the stock
         */
        public void ReplinishStock(MoveTypes moveType = MoveTypes.NORMAL)
        {
            SnapManager talonSnapManager = talon.GetComponentInChildren <SnapManager>();

            Card[] talonCards = talonSnapManager.GetCardSet();
            if (DEBUG_MODE)
            {
                Debug.Log("Cards in talon:");
            }

            // Need to iterate in reverse order so that the cards are drawn from the stock in the same order as before
            for (int i = talonCards.Length - 1; i >= 0; i--)
            {
                Card card = talonCards[i];

                // Remove from talon
                card.transform.parent = null;

                // Move the card position from the talon to the stock
                card.transform.position = new Vector3(
                    m_stockPile.position.x,
                    m_stockPile.position.y,
                    card.transform.position.z
                    );

                // Rotate the card to be face down again
                card.Flip(false);

                // Add the card to the stock
                card.transform.parent = m_stockPile;

                // Flip the first card from the stock pile over to the talon automatically
                if (i == 0)
                {
                    // Don't track this move
                    card.MoveTo(m_talonPile, null, MoveTypes.INCOGNITO);

                    // Need to manually flip card because of not tracking
                    if (card.IsFaceDown())
                    {
                        card.Flip();
                    }
                }
            }

            // Track replinish event
            if (moveType.Equals(MoveTypes.NORMAL))
            {
                Move move = new Move();
                move.SetSpecial(true);
                Event ev = new Event();
                ev.SetType(Event.EventType.REPLINISH);
                move.AddEvent(ev);
                AddMove(move, MoveTypes.NORMAL);
            }
        }
Esempio n. 2
0
        /**
         * Used for reversing a replinishing event
         */
        public void DeplinishStock(MoveTypes moveType = MoveTypes.NORMAL)
        {
            SnapManager stockSnapManager = stock.GetComponentInChildren <SnapManager>();

            Card[] stockCards = stockSnapManager.GetCardSet();

            for (int i = stockCards.Length - 1; i >= 0; i--)
            {
                Card card = stockCards[i];

                // Remove from stock
                card.transform.parent = null;

                // Move the card position from the stock to the talon
                card.transform.position = new Vector3(
                    m_talonPile.position.x,
                    m_talonPile.position.y,
                    card.transform.position.z
                    );

                // Rotate the card to be face up
                if (card.IsFaceDown())
                {
                    card.Flip(false);
                }

                // Add the card to the talon
                card.transform.parent = m_talonPile;
            }

            // Track deplinish event
            if (moveType.Equals(MoveTypes.NORMAL))
            {
                Move move = new Move();
                move.SetSpecial(true);
                Event ev = new Event();
                ev.SetType(Event.EventType.DEPLINISH);
                move.AddEvent(ev);
                AddMove(move, MoveTypes.NORMAL);
            }
        }