Пример #1
0
        internal static IEnumerator Routine(LightSwitchEventEffect lse, BeatmapEventType type, Color colour, float delay)
        {
            BloomPrePassLight[] lights = lse.GetField <BloomPrePassLight[]>("_lights");
            Dictionary <int, List <BloomPrePassLight> > lightWavesByPosition = new Dictionary <int, List <BloomPrePassLight> >();

            for (int i = 0; i < lights.Length; i++)
            {
                List <BloomPrePassLight> wave;
                if (!lightWavesByPosition.TryGetValue(Mathf.FloorToInt(lights[i].transform.position.z), out wave))
                {
                    wave = new List <BloomPrePassLight>();
                    lightWavesByPosition.Add(Mathf.FloorToInt(lights[i].transform.position.z), wave);
                }
                wave.Add(lights[i]);
            }

            ChromaLogger.Log("Found " + lightWavesByPosition.Count + " waves!");

            List <List <BloomPrePassLight> > lightWaves = new List <List <BloomPrePassLight> >();

            foreach (KeyValuePair <int, List <BloomPrePassLight> > kv in lightWavesByPosition)
            {
                lightWaves.Add(kv.Value);
            }

            for (int i = 0; i < lightWaves.Count; i++)
            {
                for (int j = 0; j < lightWaves[i].Count; j++)
                {
                    lightWaves[i][j].color = colour;
                }
                yield return(new WaitForSeconds(delay));
            }
        }
Пример #2
0
        public static SimpleColorSO SetupNewLightColourSOs(LightSwitchEventEffect light, String s, Color overrideMultiplierColour)
        {
            MultipliedColorSO mColorSO = light.GetField <MultipliedColorSO>(s);
            SimpleColorSO     baseSO   = mColorSO.GetField <SimpleColorSO>("_baseColor");

            SimpleColorSO newBaseSO = ScriptableObject.CreateInstance <SimpleColorSO>();// new SimpleColorSO();

            newBaseSO.SetColor(baseSO.color);

            MultipliedColorSO newMColorSO = ScriptableObject.CreateInstance <MultipliedColorSO>();

            if (overrideMultiplierColour == Color.clear)
            {
                newMColorSO.SetField("_multiplierColor", mColorSO.GetField <Color>("_multiplierColor"));
            }
            else
            {
                newMColorSO.SetField("_multiplierColor", overrideMultiplierColour);
            }
            newMColorSO.SetField("_baseColor", newBaseSO);

            light.SetField(s, newMColorSO);
            if (!light.name.Contains("chroma"))
            {
                light.name = light.name + "_chroma";
            }
            return(newBaseSO);
        }
Пример #3
0
 public static void ActivateTechnicolour(BeatmapEventData baseData, LightSwitchEventEffect lse, BeatmapEventType type)
 {
     BSLight[] lights = lse.GetField <BSLight[]>("_lights");
     for (int i = 0; i < lights.Length; i++)
     {
         lights[i].color = ColourManager.GetTechnicolour(baseData.value > 3, baseData.time + lights[i].GetInstanceID(), ColourManager.TechnicolourStyle.PURE_RANDOM);
     }
 }
Пример #4
0
 public override void Activate(BeatmapEventData baseData, LightSwitchEventEffect lse, BeatmapEventType type)
 {
     BSLight[] lights = lse.GetField <BSLight[]>("_lights");
     for (int i = 0; i < lights.Length; i++)
     {
         lights[i].color = UnityEngine.Random.ColorHSV().ColorWithValue(1f);                                     //ColourManager.GetTechnicolour(true, time + lights[i].GetInstanceID(), ColourManager.TechnicolourStyle.PURE_RANDOM);
     }
 }
Пример #5
0
            //We still need to do the first half of this even if the LSECM already exists as custom map colours exist and we need to be able to know the default colour
            private void InitializeSOs(LightSwitchEventEffect lse, string id, ref SimpleColorSO sColorSO, ref Color originalColour, ref MultipliedColorSO mColorSO)
            {
                MultipliedColorSO lightMultSO      = lse.GetField <MultipliedColorSO>(id);
                Color             multiplierColour = lightMultSO.GetField <Color>("_multiplierColor");
                SimpleColorSO     lightSO          = lightMultSO.GetField <SimpleColorSO>("_baseColor");

                originalColour = lightSO.color;

                if (mColorSO == null)
                {
                    mColorSO = ScriptableObject.CreateInstance <MultipliedColorSO>();
                    mColorSO.SetField("_multiplierColor", multiplierColour);

                    sColorSO = ScriptableObject.CreateInstance <SimpleColorSO>();
                    sColorSO.SetColor(originalColour);
                    mColorSO.SetField("_baseColor", sColorSO);
                }

                lse.SetField(id, mColorSO);
            }
Пример #6
0
        internal static IEnumerator Routine(LightSwitchEventEffect lse, BeatmapEventType type, Color colourFrom, Color colourTo, float duration, float freq)
        {
            BloomPrePassLight[] lights = lse.GetField <BloomPrePassLight[]>("_lights");

            float time = 0;

            while (time < duration)
            {
                for (int i = 0; i < lights.Length; i++)
                {
                    lights[i].color = Color.Lerp(colourFrom, colourTo, time / duration);
                }
                yield return(new WaitForSeconds(freq));

                time += freq;
            }
            for (int i = 0; i < lights.Length; i++)
            {
                lights[i].color = colourTo;
            }
        }