//玩家获得宝藏(金币 宝石 等货币) public bool addTreasure(GameObject obj) { treasure_property objproperty = obj.GetComponent <treasure_property> (); int itemId = objproperty.ID; int amount = objproperty.Num; char_property pro = gameObject.GetComponent <char_property> (); switch (itemId) { default: break; case 200: //constant.getMapLogic ().bagAddGold (amount); pro.addGold(amount); break; case 201: //constant.getMapLogic().bagAddDiamond(amount); break; case 202: //constant.getMapLogic ().bagAddKey (amount); pro.addKey(amount); break; case 203: //constant.getMapLogic ().bagAddGoldenKey (amount); break; break; } return(true); }
//背包增加金币 public void bagAddGold(int amount, GameObject player) { char_property charProperty = player.GetComponent <char_property> (); charProperty.addGold(amount); }