private void OnTriggerEnter(Collider other) { GrenadeThrow Grenade = grenade.GetComponent <GrenadeThrow>(); if (other.CompareTag("Player") && isTriggerPickup && Grenade.currentGrenadeCount != Grenade.maxGrenadeCount) { TakeAmmo(); AudioSource.PlayClipAtPoint(pickup, transform.position, volume); } }
private void OnTriggerEnter(Collider other) { GrenadeThrow gt = other.GetComponent <GrenadeThrow>(); if (gt != null) { gt.AddGrenade(); gameObject.SetActive(false); } }
void TakeAmmo() { GrenadeThrow Grenade = grenade.GetComponent <GrenadeThrow>(); Grenade.currentGrenadeCount += quantity; if (Grenade.currentGrenadeCount > Grenade.maxGrenadeCount) { Grenade.currentGrenadeCount = Grenade.maxGrenadeCount; } Grenade.SetUI(); Destroy(gameObject); }
// Start is called before the first frame update void Start() { // 情報を持ってくる bomb = car.GetComponent <GrenadeThrow>(); }
// Start is called before the first frame update void Start() { bomb = car.GetComponent <GrenadeThrow>(); }