예제 #1
0
 private int deposit(int x)
 {
     if (MoneyCounter.getAmt() < x)
     {
         x = MoneyCounter.getAmt();
     }
     balance += x;
     MoneyCounter.reduceAmt(x);
     text[2] = "$" + x + text[2];
     return(x);
 }
예제 #2
0
 private void OnMouseDown()
 {
     if (buttonNum == 1)
     {
         if (betAmt < MoneyCounter.getAmt())
         {
             betAmt += 10;
         }
     }
     else
     {
         if (betAmt > 10)
         {
             betAmt -= 10;
         }
     }
     gt.text = betAmt + "";
 }
예제 #3
0
 private void Update()
 {
     if (!hidden)
     {
         gt.text = text[index];
         if (index == 0)
         {
             var x = getInput();
             if (x.Equals(""))
             {
                 return;
             }
             if (x.Equals("1"))
             {
                 text[1] = options[0];
                 text[2] = options[1];
                 index   = 1;
             }
             if (x.Equals("2"))
             {
                 text[3] = options[5];
                 text[4] = options[6];
                 index   = 3;
             }
             if (x.Equals("3"))
             {
                 text[5] = "The amount of money in your account is $" + balance + ".";
                 index   = 5;
             }
             if (x.Equals("4"))
             {
                 hideBox();
             }
         }
         else if (index == 1)
         {
             var x = getInput();
             if (x.Equals(""))
             {
                 return;
             }
             if (x.Equals("1"))
             {
                 deposit(100);
             }
             if (x.Equals("2"))
             {
                 deposit(500);
             }
             if (x.Equals("3"))
             {
                 deposit(2000);
             }
             if (x.Equals("4"))
             {
                 deposit(MoneyCounter.getAmt());
             }
             index++;
         }
         else if (index == 3)
         {
             var x = getInput();
             if (x.Equals(""))
             {
                 return;
             }
             if (x.Equals("1"))
             {
                 withdraw(100);
             }
             if (x.Equals("2"))
             {
                 withdraw(500);
             }
             if (x.Equals("3"))
             {
                 withdraw(2000);
             }
             if (x.Equals("4"))
             {
                 withdraw(balance);
             }
             index++;
         }
         if (index == 5 || index == 2 || index == 4)
         {
             if (Input.GetKeyDown(KeyCode.Space))
             {
                 hideBox();
             }
         }
     }
     else
     {
         count++;
     }
 }