void UnChamberRound() { GameObject round = GetChamberedRound(); if (round != null) { round.transform.parent = null; round.transform.position = casingPoint.transform.position; round.transform.rotation = casingPoint.transform.rotation; Bullet_Controller bullet_Controller = round.GetComponent <Bullet_Controller>(); if (bullet_Controller != null) { bullet_Controller.isGrabbable = true; bullet_Controller.isLoadedInMag = false; bullet_Controller.AddRigidbody(); bullet_Controller.AddForceToBullet(Vector3.right, 100f); bullet_Controller.TogglePhysics(true); } } }
void ToggleBulletControl(GameObject obj) { Bullet_Controller bullet_Controller = obj.GetComponent <Bullet_Controller>(); if (bullet_Controller != null) { if (obj.GetComponent <Rigidbody>() != null) { bullet_Controller.TogglePhysics(false); bullet_Controller.RemoveRigidbody(); bullet_Controller.isGrabbable = false; bullet_Controller.isLoadedInMag = true; } else { bullet_Controller.TogglePhysics(true); bullet_Controller.AddRigidbody(); bullet_Controller.isGrabbable = true; bullet_Controller.isLoadedInMag = false; } } }