Exemplo n.º 1
0
        public void RemoveLight(IsoLight light)
        {
            removeLightFromStaticList(light);
            removeLightFromDynamicList(light);

            if (IsoDynamicLightList.Count == 0 && (IsoStaticLightList.Count == 0 && !Application.isPlaying))
            {
                RevertSpriteRendererColor();
#if UNITY_EDITOR
                if (!Application.isPlaying)
                {
                    UnityEditor.EditorApplication.delayCall += () =>
                    {
                        GameObject.DestroyImmediate(this);
                    };
                }
                else
#else
#endif
                { Destroy(this); }
            }
            else
            {
                ApplyLightColor();
            }
        }
Exemplo n.º 2
0
 // Josh's method. Only call if you are CERTAIN this will only be called once by each
 // light that's trying to target this reciver. Basically just skips over a bunch of checks
 // to make sure it isn't already added.
 public void AddLightDynamic_Once(IsoLight light)
 {
     IsoDynamicLightList.Add(light);
     IsoDynamicLightList.Sort((x, y) => x.UniquePriority.CompareTo(y.UniquePriority));
     UpdateLightColor(light.bStaticLight);
     //ApplyLightColor();
 }
Exemplo n.º 3
0
 void removeLightFromDynamicList(IsoLight light)
 {
     if (IsoDynamicLightList.Contains(light))
     {
         IsoDynamicLightList.RemoveAll(r => r == light);
         UpdateLightColor(false);
     }
 }
Exemplo n.º 4
0
 void removeLightFromStaticList(IsoLight light)
 {
     if (IsoStaticLightList.Contains(light))
     {
         IsoStaticLightList.RemoveAll(r => r == light);
         UpdateLightColor(true);
     }
 }
Exemplo n.º 5
0
        public static IsoLightReciver SetIsoLightReciver(this GameObject obj, IsoLight light)
        {
            IsoLightReciver reciver = obj.GetComponent <IsoLightReciver>();

            if (reciver == null)
            {
                reciver = obj.AddComponent <IsoLightReciver>();
                reciver.Init();
            }
            reciver.AddLight(light);
            return(reciver);
        }
Exemplo n.º 6
0
        void OnEnable()
        {
            if ((light = (IsoLight)target) == null)
            {
                return;
            }
            if (bPrefab = PrefabHelper.IsPrefab(light.gameObject))
            {
                return;
            }

            targetList = serializedObject.FindProperty("targetList");

            MutelightList.Clear();
            lightList.Clear();
            lightList.AddRange(FindObjectsOfType <IsoLight>());

            bTemporaryToggle_Static = bTemporaryToggle_Dynamic = false;
        }
Exemplo n.º 7
0
        void OnEnable()
        {
            if (bPrefab = PrefabUtility.GetPrefabType(target).Equals(PrefabType.Prefab))
            {
                return;
            }
            if ((light = (IsoLight)target) == null)
            {
                return;
            }

            targetList = serializedObject.FindProperty("targetList");

            MutelightList.Clear();
            lightList.Clear();
            lightList.AddRange(FindObjectsOfType <IsoLight>());

            bTemporaryToggle_Static = bTemporaryToggle_Dynamic = false;
        }
Exemplo n.º 8
0
        public bool Check(IsoLight light)
        {
            PreventlinkMissing();

            bool bLightTypeChanged;

            if (light.bStaticLight)
            {
                bLightTypeChanged = IsoStaticLightList.Contains(light) && !IsoDynamicLightList.Contains(light);
            }
            else
            {
                bLightTypeChanged = !IsoStaticLightList.Contains(light) && IsoDynamicLightList.Contains(light);
            }

            if (bLightTypeChanged)
            {
                GetLightList(light.bStaticLight).Sort((x, y) => x.UniquePriority.CompareTo(y.UniquePriority));
            }

            return(bLightTypeChanged);
        }
Exemplo n.º 9
0
        public void AddLight(IsoLight light)
        {
            if (light.bStaticLight)
            {
                removeLightFromDynamicList(light);
            }
            else
            {
                removeLightFromStaticList(light);
            }

            List <IsoLight> _list = GetLightList(light.bStaticLight);

            if (!_list.Contains(light))
            {
                _list.Add(light);
            }

            _list.Sort((x, y) => x.UniquePriority.CompareTo(y.UniquePriority));

            UpdateLightColor(light.bStaticLight);
            ApplyLightColor();
        }