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); } } }
protected void Start() { m_selfAgent.togglepSecondaryWeapon(); m_selfAgent.setHealth(health); m_selfAgent.setFaction(m_agentFaction); m_selfAgent.setPrimayWeaponAmmoCount(10); m_selfAgent.setSecondaryWeaponAmmoCount(10); }