using UnityEngine; using System.Collections; public class PlayerShootingScript : MonoBehaviour { public bool canShoot; public GameObject Bullet; public float Firerate = 1f; float fireCounter = 0; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (canShoot) { if (Input.GetAxis("Fire") == 1) { if (fireCounter > Firerate) { fireCounter = 0; gameObject.GetComponent().Play(); Instantiate(Bullet, gameObject.transform.position, Quaternion.identity); } } fireCounter += Time.deltaTime; } } }