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!");
            }
        }
Ejemplo n.º 2
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!");
            }
        }
        public void SaveButton()
        {
            if (unsavedChanges)
            {
                unsavedChanges = false;
                Deck active = new Deck();
                foreach (Card card in activeCards)
                {
                    active.AddCard(card);
                }
                profile.GetActivePlayer().AddActiveDeck(active);

                Deck secondary = new Deck();
                foreach (Card card in secondaryCards)
                {
                    secondary.AddCard(card);
                }
                profile.GetActivePlayer().AddSecondaryDeck(secondary);

                profile.SaveProfile();
            }
        }