void Update() { lifeLabel.text = "Life: " + characterControlScript.Life() + "/" + characterControlScript.MaxLife(); goldLabel.text = "G: " + CharacterControlScript.Gold(); ammoLabel.text = "残弾数: " + characterControlScript.Ammo(); stateLabel.text = "ダンジョン1階"; defeatNumberLabel.text = "倒した数: " + defeatNumber; }
public void GetItem(GameObject obj) //プレイヤーがアイテムと接触したら名前で識別 { if (obj.name == "Gold1(Clone)") { getGoldSound.PlayOneShot(getGoldSound.clip); characterControlScript.Gold(1); Destroy(obj); } else if (obj.name == "Gold10(Clone)") { getGoldSound.PlayOneShot(getGoldSound.clip); getGoldSound.PlayOneShot(getGoldSound.clip); characterControlScript.Gold(10); Destroy(obj); } else if (obj.name == "Key(Clone)") { getKeySound.PlayOneShot(getKeySound.clip); //撃った音 FlagChecker.SetFlagParameter(0, 1); Destroy(obj); } else if (obj.name == "Magazine(Clone)") { reloadSound.PlayOneShot(reloadSound.clip); //撃った音 characterControlScript.Ammo(20); Destroy(obj); } else if (obj.name == "Milk(Clone)") { if (characterControlScript.Life() < characterControlScript.MaxLife())// maxLifeよりlifeが小さい場合lifeを1回復する { getMilkSound.PlayOneShot(getKeySound.clip); characterControlScript.Life(1); } Destroy(obj); } Destroy(obj); }