void OnTriggerEnter(Collider other) { GameObject hitObject = other.gameObject; if (hitObject.tag == "Player" && renderer.enabled) { weaponController = hitObject.GetComponent <PlayerWeapons>(); if (!weaponController.HasWeaponCheck("SniperRifle")) { weaponController.AddWeapon("SniperRifle"); weaponController.SetCurrentWeapon("SniperRifle"); renderer.enabled = false; StartCoroutine(PickupReturn()); } else if (!weaponController.IsFullCheck("SniperRifle")) { curAmmo = weaponController.GetSniperCurrentAmmo(); weaponController.SetCurrentWeapon("SniperRifle"); weaponController.SetWeaponCurrentAmmo(curAmmo + plusAmmo); renderer.enabled = false; StartCoroutine(PickupReturn()); } } }
void OnTriggerEnter(Collider other) { GameObject hitObject = other.gameObject; if( hitObject.tag == "Player" && renderer.enabled ) { weaponController = hitObject.GetComponent<PlayerWeapons>(); if( ! weaponController.HasWeaponCheck("SniperRifle") ) { weaponController.AddWeapon("SniperRifle"); weaponController.SetCurrentWeapon("SniperRifle"); renderer.enabled = false; StartCoroutine( PickupReturn() ); } else if ( ! weaponController.IsFullCheck("SniperRifle") ) { curAmmo = weaponController.GetSniperCurrentAmmo(); weaponController.SetCurrentWeapon("SniperRifle"); weaponController.SetWeaponCurrentAmmo( curAmmo + plusAmmo ); renderer.enabled = false; StartCoroutine( PickupReturn() ); } } }