protected override void Awake() { base.Awake(); rateOfFireTimer = 0f; recoiler = GetComponentInChildren <Recoiler> (); }
private void Start() { gunRecoiler = GetComponentInParent <Recoiler>(); camRecoiler = FPSCamera.GetComponentInParent <Recoiler>(); gunData.currentAmmo = gunData.magazineCapacity; if (audioSource == null) { audioSource = gameObject.AddComponent <AudioSource>(); } bulletHitController = GetComponent <BulletHitController>(); }
private void Start() { // Recolier components references from gun and camera GUNRecoiler = GetComponentInParent <Recoiler>(); CAMRecoiler = FPSCAMERA.GetComponentInParent <Recoiler>(); gunData.currentAmmo = gunData.magazineCapacity; if (audioSource == null) { audioSource = gameObject.AddComponent <AudioSource>(); } }
private void Start() { //Recoiler components references from gun and camera gunRecoiler = GetComponentInParent <Recoiler>(); camRecoiler = fpsCamera.GetComponentInParent <Recoiler>(); //Start with full clip gunData.currentAmmo = gunData.magazineCapacity; GameObject.Find("AmmoText").GetComponent <UnityEngine.UI.Text>().text = gunData.currentAmmo + "/" + gunData.magazineCapacity; audioSource = GetComponent <AudioSource>(); //If there is no audioSource component in the gameObject, add one. if (audioSource == null) { audioSource = gameObject.AddComponent <AudioSource>(); } }