Exemple #1
0
        public void ProcessCard(Card card)
        {
            AddPoints(card);

            switch (card.Action)
            {
            case Card.CardAction.DrawTwo:
                Debug.Log("DrawTwo");
                //cm.Draw(NextPlayerList(), 2);
                List <Card> temp = cm.Draw(2);
                gm.MoveCardGraphicsToPanel(temp, gm.NextPlayerPanel());
                foreach (var c in temp)
                {
                    NextPlayerList().Add(c);
                }
                turnCount++;
                break;

            case Card.CardAction.None:
                Debug.Log("None");
                break;

            case Card.CardAction.Reverse:
                Debug.Log("Reverse");
                turnCount++;
                break;

            case Card.CardAction.Skip:
                Debug.Log("Skip");
                turnCount++;
                break;

            case Card.CardAction.Wild:
                Debug.Log("Wild");
                gm.ShowColorPanel();
                ShowColorPanel = true;
                break;

            case Card.CardAction.WildDraw:
                Debug.Log("WildDraw");
                gm.ShowColorPanel();
                //cm.Draw(NextPlayerList(), 4);
                List <Card> temp1 = cm.Draw(4);
                gm.MoveCardGraphicsToPanel(temp1, gm.NextPlayerPanel());
                foreach (var c in temp1)
                {
                    NextPlayerList().Add(c);
                }
                turnCount++;
                ShowColorPanel = true;
                break;
            }

            cm.Discard(card);

            currentTurn = turnCount;
        }
Exemple #2
0
        void IDropHandler.OnDrop(PointerEventData eventData)
        {
            Draggable d = eventData.pointerDrag.GetComponent <Draggable>();
            Card      c = cm.gameObjectToCard[eventData.pointerDrag];


            if (d != null)
            {
                if (cm.gameObjectToCard.ContainsKey(eventData.pointerDrag))
                {
                    if (gameObject.name == gameManager.CurrentPlayerName() + "Panel")
                    {
                        Debug.Log(eventData.pointerDrag.name + " was dropped on " + gameObject.name);
                        d.parentToReturnTo          = this.transform;
                        d.parentToReturnTo.position = this.transform.position;

                        foreach (var card in cm.Draw(1))
                        {
                            gameManager.CurrentPlayerList().Add(card);
                        }
                        //cm.Draw(gameManager.CurrentPlayerList(), 1);

                        gameManager.TogglePlayDeckLock(gameManager.CurrentPlayerList());
                    }
                }
            }
        }