protected override void Init() { customColorLeft = colorScheme.environmentColor0; customColorRight = colorScheme.environmentColor1; defaultBeatEffectDuration = Helper.GetValue <float>(beatEffectSpawner, "_effectDuration"); customLights = new LightEffectController[defaultLights.Length]; lightshowLights = new LightEffectController[defaultLights.Length]; managerWrapper = new LightWithIdManagerWrapper(lightWithIdManager); for (int i = 0; i < defaultLights.Length; i++) { LightSwitchEventEffect light = defaultLights[i]; Helper.SetValue <LightWithIdManagerWrapper>(light, "_lightManager", managerWrapper); LightEffectController customLight = LightEffectController.Create(managerWrapper, LightMode.Custom, light, timeSource); LightEffectController lightshowLight = LightEffectController.Create(managerWrapper, LightMode.CustomLightshow, light, timeSource); bocc.beatmapEventDidTriggerEvent += customLight.OnEvent; onLightModeUpdated += customLight.UpdateLightMode; CustomBeatmapEventManager.onCustomBeatmapEvent += lightshowLight.OnEvent; onLightModeUpdated += lightshowLight.UpdateLightMode; customLights[i] = customLight; lightshowLights[i] = lightshowLight; } enabled = false; }
public static LightEffectController Create( LightWithIdManagerWrapper lightManager, LightMode activeOnMode, LightSwitchEventEffect baseLight, IAudioTimeSource timeSource ) { int id = Helper.GetValue <int>(baseLight, "_lightsID"); BeatmapEventType eventTypeForThisLight = Helper.GetValue <BeatmapEventType>(baseLight, "_event"); int lastEventValue = Helper.GetValue <int>(baseLight, "_prevLightSwitchBeatmapEventDataValue"); LightEffectController controller = new GameObject("TwitchFXLightEffectController").AddComponent <LightEffectController>(); controller.timeSource = timeSource; controller.lightManager = lightManager; controller.activeOnMode = activeOnMode; controller.id = id; controller.eventTypeForThisLight = eventTypeForThisLight; controller.lastEventData = new BeatmapEventData(0f, eventTypeForThisLight, lastEventValue); controller.enabled = baseLight.enabled; if (baseLight.enabled) { float highlightValue = Helper.GetValue <float>(baseLight, "_highlightValue"); controller.transitionValue = highlightValue; controller.startColor = offColor; controller.endColor = offColor; } return(controller); }