/// <summary> /// Listens for Lights button click /// When Lights button is clicked toggle the lights ON or OFF /// </summary> private void LightControl() { if (this.lightToggle != null) { if (Input.GetButtonDown("LightToggle")) { if (minimalEnergyRestrictionToggleLights < this.LightEnergy.CurrentEnergy) { this.lightToggle.ToggleLights(); playerSound.LightToggleSound(); if (changeIntensityCoroutine != null) { StopCoroutine(changeIntensityCoroutine); } if (this.lightToggle.LightsEnabled) { this.ChangeColor(probeColorOn, true, 0); changeIntensityCoroutine = materials.ChangeLightIntensity(this.lightToggle, 0.3f); StartCoroutine(changeIntensityCoroutine); } else { this.ChangeColor(probeColorOff, true, 0); changeIntensityCoroutine = materials.ChangeLightIntensity(this.lightToggle, 0f); StartCoroutine(changeIntensityCoroutine); } } else { // If the player isn't thrusting, turn off his emissive lights if (!movement.Thrusting) { this.ChangeColor(probeColorOff, true, 0); } playerSound.InsufficientEnergySound(); } } this.lightToggle.DepleteLight(timeToDeplete, lightToggleEnergyCost); } }