public void Buy() { BackpackManager backpack_manager = objWho.GetComponent <BackpackManager>(); int money = backpack_manager.GetMoney(); if (money >= PayMoney) { for (int i = 0; i < lstItemShoppingCart.Count; i++) { backpack_manager.AddItem(lstItemShoppingCart[i]); } backpack_manager.SetMoney(money - PayMoney); } InitialShoppingCart(); }
private void DisplayWhoMoney() { txtMoney.text = "金幣 : " + backpackManager.GetMoney().ToString(); }