void OnTriggerStay(Collider col) { if (col.tag == "Weapon") { if (Input.GetButtonDown("Interact") && pickUpCooldown <= 0) { pickUpCooldown = 1f; invSystem.AddGunToList(col.GetComponent <Gun>()); Destroy(col.gameObject); } } }
void ChooseGun() { if (currentGun != null && gunEntity.currentAmmo > 0) { Debug.Log("here"); invSystem.AddGunToList(gunEntity); Destroy(currentGun); } else if (currentGun != null && gunEntity.currentAmmo <= 0) { currentGun.transform.parent = null; currentGun.AddComponent <Rigidbody>().AddForce(-Vector3.up * 2f, ForceMode.Impulse); currentGun.AddComponent <BoxCollider>(); } if (currentChoice < invSystem.gunList.Count - 1) { currentChoice++; } else { currentChoice = 0; } currentGun = invSystem.TakeWeaponFromInventory(currentChoice); currentGun.transform.parent = transform.parent; currentGun.transform.position = transform.position; currentGun.transform.rotation = transform.rotation; currentGun.SetActive(true); GetGunReference(currentGun); }