public void ValueChangeCheckText() { //lightIntensity.value = float.Parse(lightIntensityInput.text); //Debug.Log("ValueChangeCheckText: Colors: R:" + lightColorR.value + " / G:" + lightColorG.value + " / B:" + lightColorB.value); lightColorR.value = float.Parse(lightColorRInput.text); lightColorG.value = float.Parse(lightColorGInput.text); lightColorB.value = float.Parse(lightColorBInput.text); lightIntensity.value = float.Parse(lightIntensityInput.text); lightPan.value = float.Parse(lightPanInput.text); lightTilt.value = float.Parse(lightTiltInput.text); float[] parsedPos = new float[3]; if (float.TryParse(lightPosX.text, out parsedPos[0]) && float.TryParse(lightPosY.text, out parsedPos[1]) && float.TryParse(lightPosZ.text, out parsedPos[2])) { lightFixture.transform.position = new Vector3(parsedPos[0], parsedPos[1], parsedPos[2]); // Update the spotlight's range, to make sure it's at least as powerful as its new distance from the origin lightFixture.spotlight.range = Vector3.Distance(lightFixture.transform.position, new Vector3(13f, 0, 13f)); // Adjust for center stage if (lightFixture.spotlight.range < 40f) // Clamp minimum of 30f; { lightFixture.spotlight.range = 40f; } if (errorPosition.activeInHierarchy) { errorPosition.SetActive(false); lightPosX.GetComponent <Image>().color = inputFieldColor; lightPosY.GetComponent <Image>().color = inputFieldColor; lightPosZ.GetComponent <Image>().color = inputFieldColor; } } else { errorPosition.SetActive(true); lightPosX.GetComponent <Image>().color = inputErrorColor; lightPosY.GetComponent <Image>().color = inputErrorColor; lightPosZ.GetComponent <Image>().color = inputErrorColor; } lightFixture.captureData.posX = -lightFixture.transform.position.x; lightFixture.captureData.posY = lightFixture.transform.position.y; lightFixture.captureData.posZ = lightFixture.transform.position.z; lightFixture.SetEmissionColor(lightFixture.spotlight.intensity, colorPreview.color); //colorPreview.color = new Color(lightColorR.value / 255.0f, lightColorG.value / 255.0f, lightColorB.value / 255.0f); //lightFixture.spotlight.color = colorPreview.color; //lightFixture.GetComponentInChildren<VLB.BeamGeometry>().gameObject.GetComponent<Renderer>().material.SetColor("_Color", colorPreview.color); }
public void IntensityChangeCheck() { lightIntensityInput.text = lightIntensity.value.ToString(); lightFixture.spotlight.intensity = Globals.AdjustLight(lightIntensity.value); colorPreview.color = new Color(lightColorR.value / 255.0f, lightColorG.value / 255.0f, lightColorB.value / 255.0f); lightFixture.spotlight.color = colorPreview.color; lightFixture.SetEmissionColor(lightFixture.spotlight.intensity, colorPreview.color); lightFixture.GetComponentInChildren <VLB.BeamGeometry>().gameObject.GetComponent <Renderer>().material.SetColor("_Color", colorPreview.color); foreach (int id in gameManager.captureImport.channels[lightFixture.captureData.channel].lightIds) { LightFixture channelFixture = gameManager.lightManager.lightIds[id].GetComponent <LightFixture>(); channelFixture.spotlight.intensity = Globals.AdjustLight(lightIntensity.value); channelFixture.SetEmissionColor(Globals.AdjustLight(lightIntensity.value), gameManager.lightManager.lightIds[id].GetComponent <LightFixture>().spotlight.color); if (lightFixture.spotlight.intensity > 0.05f) { if (Globals.ShowingHaze) { VLB.VolumetricLightBeam beamComponent = gameManager.lightManager.lightIds[id].GetComponentInChildren <VLB.VolumetricLightBeam>(); beamComponent.enabled = true; Material beamRenderer = channelFixture.GetComponentInChildren <VLB.BeamGeometry>().gameObject.GetComponent <Renderer>().material; beamRenderer.SetFloat("_AlphaInside", Globals.AdjustBeamValue(Globals.LightBeamInside, lightIntensity.value)); beamRenderer.SetFloat("_AlphaOutside", Globals.AdjustBeamValue(Globals.LightBeamOutside, lightIntensity.value)); } } else { gameManager.lightManager.lightIds[id].GetComponentInChildren <VLB.VolumetricLightBeam>().enabled = false; } } }