private ILightAction GetLightAction() { if (strobe) { lightAction = new LightActionStrobe(); } else if (!strobe) { lightAction = new LightActionFade(); } return(lightAction); }
private void Awake() { lightObj = this.gameObject.GetComponent <Light>(); lightAction = GetLightAction(); //--------------------------------------------------------------- // Disable other features of audio visualizer is applied to light //--------------------------------------------------------------- if (visualize) { strobe = colorRandomizer = false; } }
void Update() { //----------------------------------------------- // Stop active co-routines when light is disabled //----------------------------------------------- if (!Enabled && !coRoutinesStopped) { StopAllCoroutines(); coRoutinesStopped = true; } if (!visualize) { lightAction = GetLightAction(); StartCoroutine(lightAction.ModulateLight(lightObj, speed, upperIntensityBounds, lowerIntensityBounds)); } else if (visualize) { lightObj.intensity = ((audioVisualizer.audioBandBuffer[band] * scaleMagnitude) * (maxIntensity - minIntensity) + minIntensity); } if (rotate) { rotateType.Rotate(gameObject, xAngle, yAngle, zAngle, period, rotationSpeed); } if (colorRandomizer) { if (gameObject.GetComponent <RandomColor>() == null) { randomColor = gameObject.AddComponent <RandomColor>(); } randomColor.Randomize(randomizeTime); } }