Пример #1
0
        public static SimpleColorSO SetupNewLightColourSOs(MonoBehaviour 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);
        }
Пример #2
0
            private static MultipliedColorSO CreateMultipliedColorSO(SimpleColorSO simpleColor, Color color)
            {
                MultipliedColorSO multipliedColor = ScriptableObject.CreateInstance <MultipliedColorSO>();

                multipliedColor.SetField("_baseColor", simpleColor);
                multipliedColor.SetField("_multiplierColor", color);
                return(multipliedColor);
            }
Пример #3
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);
            }
Пример #4
0
            private void InitializeSOs(MonoBehaviour lse, string id, ref SimpleColorSO sColorSO, ref Color originalColor, ref MultipliedColorSO mColorSO)
            {
                MultipliedColorSO lightMultSO = null;

                if (lse is LightSwitchEventEffect l1)
                {
                    lightMultSO = (MultipliedColorSO)l1.GetField <ColorSO, LightSwitchEventEffect>(id);
                }
                else if (lse is ParticleSystemEventEffect p1)
                {
                    lightMultSO = (MultipliedColorSO)p1.GetField <ColorSO, ParticleSystemEventEffect>(id);
                }

                Color         multiplierColor = lightMultSO.GetField <Color, MultipliedColorSO>("_multiplierColor");
                SimpleColorSO lightSO         = lightMultSO.GetField <SimpleColorSO, MultipliedColorSO>("_baseColor");

                originalColor = lightSO.color;

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

                    if (sColorSO == null)
                    {
                        sColorSO = ScriptableObject.CreateInstance <SimpleColorSO>();
                        sColorSO.SetColor(originalColor);
                    }

                    mColorSO.SetField("_baseColor", sColorSO);
                }

                if (lse is LightSwitchEventEffect l2)
                {
                    l2.SetField <LightSwitchEventEffect, ColorSO>(id, mColorSO);
                }
                else if (lse is ParticleSystemEventEffect p2)
                {
                    p2.SetField <ParticleSystemEventEffect, ColorSO>(id, mColorSO);
                }
            }