// Update is called once per frame void Update() { MoveNozzle(); if (Input.GetMouseButtonDown(0)) { audioManager.Stop("LSDecay"); lazerParticleSystem.Play(); audioManager.Play("LSAttack"); audioManager.PlayDelayed("LSSustain", "LSAttack"); } if (Input.GetMouseButton(0)) { color = (Colors)(int)Random.Range((int)Colors.red, (int)Colors.white); Shoot(); } if (Input.GetMouseButtonUp(0)) { audioManager.Play("LSDecay"); } if (!Input.GetMouseButton(0)) { lazerParticleSystem.Stop(); audioManager.Stop("LSSustain"); audioManager.Stop("LSAttack"); } }
// Update is called once per frame void Update() { if (_GM.gameIsPlaying || _GM.overrideCanonControl) { MoveNozzle(); if (Input.GetButtonDown(fireRedKeyName) || Input.GetButtonDown("fireGreen") || Input.GetButtonDown("fireBlue")) { audioManager.Stop("LSDecay"); decayIsPlaying = false; lazerParticleSystem.Play(); if (!soundIsPlaying) { audioManager.Play("LSAttack"); audioManager.PlayDelayed("LSSustain", "LSAttack"); soundIsPlaying = true; } } if ((Input.GetButton(fireRedKeyName) || Input.GetButton("fireGreen") || Input.GetButton("fireBlue")) /* & activeTime < maxActiveTime*/) { if (Input.GetButton(fireRedKeyName)) { isRed = true; color = Colors.red; } if (Input.GetButton("fireGreen")) { isGreen = true; if (isRed) { color = Colors.yellow; } else { color = Colors.green; } } if (Input.GetButton("fireBlue")) { isBlue = true; color = Colors.blue; if (isRed) { color = Colors.magenta; if (isGreen) { color = Colors.white; } } if (isGreen & !isRed) { color = Colors.cyan; } } Shoot(); isRed = false; isGreen = false; isBlue = false; } if ((!Input.GetButton(fireRedKeyName) & !Input.GetButton("fireGreen") & !Input.GetButton("fireBlue")) & !decayIsPlaying & soundIsPlaying) { audioManager.Play("LSDecay"); decayIsPlaying = true; } if (!Input.GetButton(fireRedKeyName) & !Input.GetButton("fireGreen") & !Input.GetButton("fireBlue")) { lazerParticleSystem.Stop(); audioManager.Stop("LSSustain"); audioManager.Stop("LSAttack"); soundIsPlaying = false; } } if (!_GM.gameIsPlaying) { lazerParticleSystem.Stop(); CheckKeyBinding(); } }