Exemplo n.º 1
0
        public CardsValue GiveCard()
        {
            CardsValue result = DeckContent[DeckContent.Count - 1];

            DeckContent.RemoveAt(DeckContent.Count - 1);
            return(result);
        }
Exemplo n.º 2
0
        public void ShuffleDeck()
        {
            List <CardsValue> temp         = new List <CardsValue>();
            Random            deckRandomer = new Random();

            DeckContent.Clear();
            for (int i = 0; i < NumberOfDecks * numberOfSuits; ++i)
            {
                DeckContent.Add(CardsValue.Two);
                DeckContent.Add(CardsValue.Three);
                DeckContent.Add(CardsValue.Four);
                DeckContent.Add(CardsValue.Five);
                DeckContent.Add(CardsValue.Six);
                DeckContent.Add(CardsValue.Seven);
                DeckContent.Add(CardsValue.Eight);
                DeckContent.Add(CardsValue.Nine);
                DeckContent.Add(CardsValue.Ten);
                DeckContent.Add(CardsValue.Jack);
                DeckContent.Add(CardsValue.Queen);
                DeckContent.Add(CardsValue.King);
                DeckContent.Add(CardsValue.Ace);
            }

            while (DeckContent.Count != 0)
            {
                int takenCardsPos = deckRandomer.Next(DeckContent.Count - 1);
                temp.Add(DeckContent[takenCardsPos]);
                DeckContent.RemoveAt(takenCardsPos);
            }

            DeckContent = temp;
        }
        public void DeckAlreadySetupAtStart()
        {
            DeckContent baseDeck = Resources.Load <DeckContent>("decks/GameDeck");

            //GameEngine.Instance.CurrentState = GameEngine.GameState.DRAFTING;
            Assert.AreEqual(baseDeck.cards, GameEngine.Instance.playerDeck.GetCards());
        }
Exemplo n.º 4
0
 //Set Player deck content
 public void SetPlayerDeck(DeckContent theDeckChoosed)
 {
     //Debug.Log("le deck sélectionner fait : " + theDeckChoosed.cards.Count);
     foreach (BasicCard card in theDeckChoosed.cards)
     {
         AddCardToPlayerDeck(card);
     }
     //Debug.Log("le deck fait maintenant : " + playerDeck.Count());
 }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        //Dropを受け取るUI作成。
        GameObject prefab = Resources.Load("Prefab/UI/Custom/DeckContent") as GameObject;

        for (int idx = 0; idx < Data.Deck.bulletNum; idx++)
        {
            GameObject  content = Instantiate(prefab, transform);
            DeckContent deck    = content.GetComponent <DeckContent>();
            deck.bulletsDeck = this;
            deck.idx         = idx;
        }
        _Contents = GetComponentsInChildren <DeckContent>();
        //
        SetDeckIcon();
    }
Exemplo n.º 6
0
    /**
     * update the deck gameObject using the deck data
     */
    public void UpdateDeck(DeckContent deckData)
    {
        //Save the scriptableObject use by this deck gameObject
        deck   = deckData;
        deckId = deck.id;

        nameText.text = deckData.name;
        //descriptionText.text = deckData.description;

        if (deckData.cards.Count != 0)
        {
            deck.cards = deckData.cards;
        }
        if (deckData.artwork)
        {
            deck.artwork = deckData.artwork;
        }
    }
Exemplo n.º 7
0
        /**
         * updates all cards displayed relative to the card in the selected deck
         */
        public void UpdateCards(DeckContent deck)
        {
            deckName.text        = deck.name;
            deckDescription.text = deck.description;

            for (int i = 0; i < cardsDisplayed.Count; i++)
            {
                //exit the loop if all the card of the deck have been checked
                if (i < deck.cards.Count)
                {
                    cardsDisplayed[i].UpdateCard(deck.cards[i]);
                }
                else
                {
                    return;
                }
            }
        }