void Update() { if (parameter.inputGrenade && playerItems.HaveItem(bombId)) { UserBomb(); } }
//ユーザがbombを拾う void OnTriggerEnter(Collider other) { //対象はユーザ if (other.gameObject == player) { //ユーザはbombを持っていない if (!playerItems.HaveItem(bombId)) { //拾う音声を流す AudioSource.PlayClipAtPoint(itemPickUp, transform.position); //bombIdをplayerItemsに渡す playerItems.AddItem(bombId); //このbombを削除 Destroy(this.gameObject); } else { //ユーザがbombを持っていたら、”これ以上持てません”と画面上に提示する bombText.enabled = true; } } }