コード例 #1
0
            private void AddMoney()
            {
                Console.WriteLine("Choose the wallet:\n(1) USD Wallet\n(2) EUR Wallet\n(3) UAH Wallet\n(4) RUB Wallet\n(5) CNY Wallet");
                var userOperation = Console.ReadLine();

                if (userOperation == "1" & USD == true)
                {
                    walletUSD.AddMoney();
                }
                else if (userOperation == "2" & EUR == true)
                {
                    walletEUR.AddMoney();
                }
                else if (userOperation == "3" & UAH == true)
                {
                    walletUAH.AddMoney();
                }
                else if (userOperation == "4" & RUB == true)
                {
                    walletRUB.AddMoney();
                }
                else if (userOperation == "5" & CNY == true)
                {
                    walletCNY.AddMoney();
                }
                else
                {
                    Console.WriteLine("There is no such wallet or you haven't enabled it yet.");
                }
            }
コード例 #2
0
        private void GivePlayerRandomValue(Collider other)
        {
            Wallet wallet      = other.GetComponent <Wallet>();
            int    randomValue = Random.Range(minValue, maxValue + 1);

            wallet.AddMoney(randomValue);
        }
コード例 #3
0
        public void WalletShouldAddBalance()
        {
            var wallet = new Wallet(100);

            wallet.AddMoney(103);

            Assert.Equal(wallet.Balance, 100 + 103);
        }
コード例 #4
0
 public void SellProfits()
 {
     // enable all cards when invested
     wallet.AddMoney(invested);
     unaffectedInvest = 0;
     invested         = 0f;
     loss             = 0f;
     profit           = 0f;
     investedIdeas.Clear();
 }
コード例 #5
0
        public void SellItem(Item i)
        {
            //If at a shop, we have the item, and the shop can afford/will be able to resell it
            if (currentShop && inventory.HasNumberOfItem(i, 1) && currentShop.TryBuyFromPlayer(i))
            {
                inventory.RemoveFromInventory(i, 1);

                wallet.AddMoney(i.GetPrice());
            }
        }
コード例 #6
0
    public bool Pay(int cost, Wallet to)
    {
        if (cost > money)
        {
            return(false);
        }

        money -= cost;
        to.AddMoney(cost);
        return(true);
    }
コード例 #7
0
        /// <summary>
        /// Shop is selling to the player.
        /// </summary>
        /// <param name="i"></param>
        public void SellToPlayer(Item i)
        {
            if (!shopper || !HasNumberOfItem(i, 1))
            {
                return;
            }

            if (shopper.TryBuyItem(i, 1))
            {
                RemoveFromInventory(i, 1);

                wallet.AddMoney(i.GetPrice());
            }
        }
コード例 #8
0
ファイル: PassiveIncomeSystem.cs プロジェクト: Akinat0/Money
    void EarnIncome()
    {
        TimeToIncome += Time.deltaTime;

        if (TimeToIncome >= IncomeDelay)
        {
            TimeToIncome = 0f;

            Debug.Log("Earn income");


            int totalProfit = 0;
            foreach (var income in Incomes)
            {
                totalProfit += income;
            }

            _wallet.AddMoney(totalProfit);
        }
    }
コード例 #9
0
ファイル: Wallet.cs プロジェクト: KhuonVietTeam/demo1
 public void GetAmount(int amountToGet)
 {
     _wallet.AddMoney(amountToGet);
 }