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(); } }
// 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(); }
void removeLightFromDynamicList(IsoLight light) { if (IsoDynamicLightList.Contains(light)) { IsoDynamicLightList.RemoveAll(r => r == light); UpdateLightColor(false); } }
void removeLightFromStaticList(IsoLight light) { if (IsoStaticLightList.Contains(light)) { IsoStaticLightList.RemoveAll(r => r == light); UpdateLightColor(true); } }
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); }
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; }
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; }
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); }
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(); }