// Update is called once per frame void Update() { cooldownTimer -= Time.deltaTime; energyGain += Time.deltaTime; // GunSpotR = PlayerShip.transform.Find("GunSpotR").gameObject; if (Input.GetButton("Fire1") && cooldownTimer <= 0 && energy.currentEnergy > 0) { cooldownTimer = fireDelay; Instantiate(bulletprefab, transform.position, transform.rotation); energy.DecromentEnergy(); } }