private void OnTriggerEnter(Collider other) { if (other.tag == "Ammo") { Ammo ammo = other.GetComponent <Ammo>(); switch (ammo.m_ammoType) { case Ammo.AMMO_TYPE.Primary: m_movingAgent.setPrimayWeaponAmmoCount(m_movingAgent.getPrimaryWeaponAmmoCount() + ammo.count); break; case Ammo.AMMO_TYPE.Secondary: m_movingAgent.setSecondaryWeaponAmmoCount(m_movingAgent.getSecondaryWeaponAmmoCount() + ammo.count); break; default: break; } audioSocurce.Play(); if (ammo.destory) { Destroy(ammo.gameObject); } else { other.gameObject.SetActive(false); } } }
// Update is called once per frame void Update() { primaryBulletCount.text = m_movingAgent.getPrimaryWeaponAmmoCount().ToString(); secondaryBulletCount.text = m_movingAgent.getSecondaryWeaponAmmoCount().ToString(); if (SimpleInput.GetButtonDown("Crouch")) { crouched = !crouched; if (crouched) { crouchButton.color = Color.cyan; } else { crouchButton.color = Color.white; } } }