Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class NewBehaviourScript : MonoBehaviour {
- public Transform bullet;
- public int BulletForce = 5000;
- public int Magaz = 15;
- void Update () {
- if (Input.GetMouseButtonDown(0) && Magaz > 0) {
- Transform BulletInstance = Instantiate(bullet, GameObject.Find("spawn").transform.position, Quaternion.identity);
- BulletInstance.GetComponent<Rigidbody>().AddForce(transform.forward * BulletForce);
- Magaz -= 1;
- }
- if (Input.GetKeyDown(KeyCode.R)) {
- Magaz = 15;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement