Exemple #1
0
        /// <summary>
        /// Registers a new object that depends on the Lightmap Variant Index to know if it should be active or not.
        /// </summary>
        /// <param name="obj">The object.</param>
        public static void RegisterVertexLightDependentObject(VertexLightDependentObject obj)
        {
            if (obj.SupportedTimes == null || obj.SupportedTimes.Length == 0)
            {
                return;
            }

            if (_data == null)
            {
                SetupData();
            }

            if (_data.CurrentLightingVariantIndex == VertexLightingTimeIndex.None)
            {
                if (_data.LightmapDependentObjects == null)
                {
                    _data.LightmapDependentObjects = new Stack <VertexLightDependentObject>(10);
                }

                _data.LightmapDependentObjects.Push(obj);
                return;
            }

            CheckVertexLightDependentObject(obj);
        }
Exemple #2
0
        /// <summary>
        /// Effectively makes the check to know if the object in question should or not be active at the current lightmap
        /// variant. If objects registered BEFORE a variant has been set, they will be queued in a stack, and then processed
        /// when the lightmap variant has been set.
        /// </summary>
        /// <param name="obj">The object.</param>
        private static void CheckVertexLightDependentObject(VertexLightDependentObject obj)
        {
            for (byte i = 0; i < obj.SupportedTimes.Length; i++)
            {
                if (obj.SupportedTimes[i] == _data.CurrentLightingVariantIndex)
                {
                    obj.LightsHolder.SetActive(true);
                    return;
                }
            }

            obj.LightsHolder.SetActive(false);
        }