// **** Other Functions **** public void TurnOnLaser() { if (actualLaser.gameObject.GetComponent <SpriteRenderer>().enabled == false) { actualLaser.EnableDisable(); } }
// **** Other Functions **** void Timer() { if (pause > 0) // pause on turn off/on { pause -= Time.deltaTime; } if (laserUp == false && pause <= 0) // timing for the laser { time += Time.deltaTime; laserTimer.fillAmount = time / maxTime; } else if (pause <= 0) { time -= Time.deltaTime; laserTimer.fillAmount = time / maxTime; } if (time / maxTime >= 1 && pause <= 0) { laserUp = true; actualLaser.EnableDisable(); pause = pauseTime; } if (time / maxTime <= 0 && pause <= 0) { laserUp = false; if (actualLaser.EnableDisable()) { soundSource.switchOn(); } else { soundSource.switchOff(); } pause = pauseTime; // there should be a better way than this duplication } }