Guest User

Untitled

a guest
Jun 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. public IEnumerator setMoney(int amount) {
  2.  
  3.        
  4.  
  5.        
  6.  
  7.         amount = amount - playerMoney;
  8.  
  9.        
  10.  
  11.        
  12.  
  13.         for (int i = 0; i < Mathf.Abs(amount); i++) {
  14.  
  15.             if (moneyCounting) {
  16.  
  17.                 break;
  18.  
  19.             }
  20.  
  21.             if (amount > 0) {
  22.  
  23.                 playerMoney += 1;
  24.  
  25.             } else {
  26.  
  27.                 playerMoney -= 1;
  28.  
  29.             }
  30.  
  31.             yield return new WaitForSeconds(0.01f);
  32.  
  33.             if (i == Mathf.Abs(amount)) {
  34.  
  35.                 moneyCounting = false;
  36.  
  37.             }
  38.  
  39.         }
  40.  
  41.     }
Add Comment
Please, Sign In to add comment