Exemple #1
0
        public void BuyItem()
        {
            if (profile.GetActivePlayer().GetCoinBalance() >= chipsData[index].GetPrice())
            {
                cardList.Clear();

                profile.GetActivePlayer().SpendCoins(chipsData[index].GetPrice());

                int cardNumber = chipsData[index].GetValue() + GetBonus();
                for (var i = 0; i < cardNumber; i++)
                {
                    Card temp = cardData.GetRandomCard();
                    cardList.Add(temp);
                    profile.GetActivePlayer().GetSecondaryDeck().AddCard(temp);
                }

                Profile_Controller.settingsState = ProfileSettings.Silent;
                profile.SaveProfile();
                balance.text = profile.GetActivePlayer().GetCoinBalance().ToString();
                RefreshMenu();

                boughtCardWindow = Instantiate(boughtCardWindowPrefab);
                boughtCardWindow.GetComponent <BoughtCard_Panel>().SetupPanel(cardList);
            }

            else
            {
                Notification_Controller.DisplayNotification("Nem rendelkezel elég érmével!");
            }
        }
Exemple #2
0
 private void Awake()
 {
     cardList     = new List <Card>();
     index        = 0;
     profile      = GameObject.Find("Profile_Controller").GetComponent <Profile_Controller>();
     balance.text = profile.GetActivePlayer().GetCoinBalance().ToString();
     RefreshMenu();
 }
        public void StartSinglePlayer(int playerNumber)
        {
            bool result;
            int  price;

            switch (playerNumber)
            {
            case 1: price = 0; result = (profileController.GetActivePlayer().GetCoinBalance() >= price); break;

            case 2: price = 100; result = (profileController.GetActivePlayer().GetCoinBalance() >= price); break;

            case 3: price = 200; result = (profileController.GetActivePlayer().GetCoinBalance() >= price); break;

            default: result = false; price = 0; break;
            }

            if (result)
            {
                profileController.GetActivePlayer().SpendCoins(price);
                Profile_Controller.settingsState = ProfileSettings.Silent;
                profileController.SaveProfile();

                dataController.SetOpponents(playerNumber);
                SceneManager.LoadScene("SinglePlayer_Battle");
            }

            else
            {
                Notification_Controller.DisplayNotification("Nem rendelkezel elég érmével!");
            }
        }
        private void CreateCards()
        {
            profile.GetActivePlayer().GetActiveDeck().SortDeck();
            activeCards = profile.GetActivePlayer().GetActiveDeck().GetDeck();

            foreach (Card card in activeCards)
            {
                GameObject temp = Instantiate(cardPrefab);
                temp.GetComponent <DeckOrganiseCard>().AddData(card);
                activeCardField.AddNewCard(temp);
            }

            profile.GetActivePlayer().GetSecondaryDeck().SortDeck();
            secondaryCards = profile.GetActivePlayer().GetSecondaryDeck().GetDeck();
            foreach (Card card in secondaryCards)
            {
                GameObject temp = Instantiate(cardPrefab);
                temp.GetComponent <DeckOrganiseCard>().AddData(card);
                secondaryCardField.AddNewCard(temp);
            }
        }