From f52e0f2cafc8f7e72cde215703494d5a35683bd5 Mon Sep 17 00:00:00 2001 From: Nickc01 Date: Wed, 19 Jun 2024 12:58:23 -0500 Subject: [PATCH] Fixed Item Get Message fade issues --- .../Materials/Chinese Bold Material.mat | 2 +- .../Materials/Japanese Material.mat | 2 +- .../Materials/Korean Material.mat | 2 +- .../Materials/Perpetua-SDF Material.mat | 2 +- .../Materials/Russian Fallback Material.mat | 2 +- .../Materials/Russian Material.mat | 2 +- .../Materials/Simsun Chinese Material.mat | 2 +- .../Materials/TrajanPro-Bold Material.mat | 2 +- .../Materials/perpetua_tmpro Material.mat | 2 +- .../Components/DroppedCustomCharmItem.cs | 1 + WeaverCore/Components/DroppedItem.cs | 15 +++ WeaverCore/Features/WeaverCharm.cs | 12 +- WeaverCore/Utilities/CharmUtilities.cs | 11 ++ WeaverCore/Utilities/RendererUtilities.cs | 114 ++++++++++++++++++ .../Utilities/RendererUtilities.cs.meta | 11 ++ WeaverCore/Utilities/TypeUtilities.cs | 9 +- .../Components/Map/ItemGetMessage.cs | 44 ++++--- 17 files changed, 201 insertions(+), 34 deletions(-) create mode 100644 WeaverCore/Utilities/RendererUtilities.cs create mode 100644 WeaverCore/Utilities/RendererUtilities.cs.meta diff --git a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Chinese Bold Material.mat b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Chinese Bold Material.mat index 8deb3cbe..bf1c2b2f 100644 --- a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Chinese Bold Material.mat +++ b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Chinese Bold Material.mat @@ -32,7 +32,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 2800000, guid: 8acfdb48cc2a635439fbd1eff244a928, type: 3} + m_Texture: {fileID: 2800000, guid: 2185737cc0508734aa7386644f6a477e, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _OutlineTex: diff --git a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Japanese Material.mat b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Japanese Material.mat index bc6069d3..2dce86f0 100644 --- a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Japanese Material.mat +++ b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Japanese Material.mat @@ -32,7 +32,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 2800000, guid: 8acfdb48cc2a635439fbd1eff244a928, type: 3} + m_Texture: {fileID: 2800000, guid: 60a836d715be9a247b83bdb65dd4382d, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _OutlineTex: diff --git a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Korean Material.mat b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Korean Material.mat index c8bf1a1f..c96ebfdd 100644 --- a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Korean Material.mat +++ b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Korean Material.mat @@ -32,7 +32,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 2800000, guid: 8acfdb48cc2a635439fbd1eff244a928, type: 3} + m_Texture: {fileID: 2800000, guid: d2627649b701d9141a6507c7efbff250, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _OutlineTex: diff --git a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Perpetua-SDF Material.mat b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Perpetua-SDF Material.mat index 38fb7b93..b2ee3ed9 100644 --- a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Perpetua-SDF Material.mat +++ b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Perpetua-SDF Material.mat @@ -32,7 +32,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 2800000, guid: 8acfdb48cc2a635439fbd1eff244a928, type: 3} + m_Texture: {fileID: 2800000, guid: 774cdb224155cee4ba5fa38929c07c3b, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _OutlineTex: diff --git a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Russian Fallback Material.mat b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Russian Fallback Material.mat index c280607e..70050f17 100644 --- a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Russian Fallback Material.mat +++ b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Russian Fallback Material.mat @@ -32,7 +32,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 2800000, guid: 8acfdb48cc2a635439fbd1eff244a928, type: 3} + m_Texture: {fileID: 2800000, guid: a98fb8a1d49582841abecec09d8d5732, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _OutlineTex: diff --git a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Russian Material.mat b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Russian Material.mat index f7136686..73e572dd 100644 --- a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Russian Material.mat +++ b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Russian Material.mat @@ -32,7 +32,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 2800000, guid: 8acfdb48cc2a635439fbd1eff244a928, type: 3} + m_Texture: {fileID: 2800000, guid: 2edecbaeb5eabd54f8eafc52ceb07d8b, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _OutlineTex: diff --git a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Simsun Chinese Material.mat b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Simsun Chinese Material.mat index e5737672..19823e52 100644 --- a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Simsun Chinese Material.mat +++ b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/Simsun Chinese Material.mat @@ -32,7 +32,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 2800000, guid: 8acfdb48cc2a635439fbd1eff244a928, type: 3} + m_Texture: {fileID: 2800000, guid: 35ad0f3b09dbc1747bb59a9c83f86243, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _OutlineTex: diff --git a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/TrajanPro-Bold Material.mat b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/TrajanPro-Bold Material.mat index a7ba5f57..81f55cb5 100644 --- a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/TrajanPro-Bold Material.mat +++ b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/TrajanPro-Bold Material.mat @@ -32,7 +32,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 2800000, guid: 8acfdb48cc2a635439fbd1eff244a928, type: 3} + m_Texture: {fileID: 2800000, guid: 5e594fbf23cbc344982af33961eeafea, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _OutlineTex: diff --git a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/perpetua_tmpro Material.mat b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/perpetua_tmpro Material.mat index 33a24936..535a1090 100644 --- a/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/perpetua_tmpro Material.mat +++ b/Hollow Knight/TextMesh Pro/TextMesh Pro/Resources/Fonts & Materials/Materials/perpetua_tmpro Material.mat @@ -32,7 +32,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 2800000, guid: 8acfdb48cc2a635439fbd1eff244a928, type: 3} + m_Texture: {fileID: 2800000, guid: c6f692727898ca145aaa2636704815f4, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _OutlineTex: diff --git a/WeaverCore/Components/DroppedCustomCharmItem.cs b/WeaverCore/Components/DroppedCustomCharmItem.cs index 6d150674..fddd6c20 100644 --- a/WeaverCore/Components/DroppedCustomCharmItem.cs +++ b/WeaverCore/Components/DroppedCustomCharmItem.cs @@ -16,6 +16,7 @@ public class DroppedCustomCharmItem : DroppedItem protected override void OnGiveItem() { + //WeaverLog.Log("CHARM = " + charm); if (charm == null) { throw new System.Exception("No charm has been specified"); diff --git a/WeaverCore/Components/DroppedItem.cs b/WeaverCore/Components/DroppedItem.cs index fcae4992..9a12a0d1 100644 --- a/WeaverCore/Components/DroppedItem.cs +++ b/WeaverCore/Components/DroppedItem.cs @@ -62,8 +62,20 @@ protected virtual void Awake() IEnumerator DroppedItemRoutine() { + if (SettingsStorage != null) + { + //WeaverLog.Log("OLD SETTINGS DUMP = " + JsonUtility.ToJson(SettingsStorage, true)); + var result = SaveSpecificSettings.GetSaveSettings(SettingsStorage.GetType()); + if (result != null) + { + SettingsStorage = result; + //WeaverLog.Log("NEW SETTINGS DUMP = " + JsonUtility.ToJson(result, true)); + } + } transform.rotation = Quaternion.identity; + //WeaverLog.Log("CAN SPAWN = " + CanSpawn()); + if (!CanSpawn()) { Destroy(gameObject); @@ -156,6 +168,9 @@ protected virtual bool CanSpawn() { if (SettingsStorage.HasField(SettingsField)) { + var result = SettingsStorage.GetFieldValue(SettingsField); + //WeaverLog.Log($"{SettingsField} = {result}"); + //WeaverLog.Log("CAN SPAWN RESULT = " + !result); return !SettingsStorage.GetFieldValue(SettingsField); } else diff --git a/WeaverCore/Features/WeaverCharm.cs b/WeaverCore/Features/WeaverCharm.cs index bf36c915..a40f86cc 100644 --- a/WeaverCore/Features/WeaverCharm.cs +++ b/WeaverCore/Features/WeaverCharm.cs @@ -57,7 +57,7 @@ public virtual bool Acquired } else { - throw new Exception($"The settings field {StringUtilities.Prettify(nameof(acquired_settingsField))} doesn't point to a valid field"); + throw new Exception($"The settings field {nameof(acquired_settingsField)} doesn't point to a valid field. Tried to access field: {acquired_settingsField}"); } } @@ -69,7 +69,7 @@ public virtual bool Acquired } else { - throw new Exception($"The settings field {StringUtilities.Prettify(nameof(acquired_settingsField))} doesn't point to a valid field"); + throw new Exception($"The settings field {nameof(acquired_settingsField)} doesn't point to a valid field. Tried to access field: {acquired_settingsField}"); } } } @@ -83,7 +83,7 @@ public virtual bool Equipped } else { - throw new Exception($"The settings field {StringUtilities.Prettify(nameof(equipped_settingsField))} doesn't point to a valid field"); + throw new Exception($"The settings field {nameof(equipped_settingsField)} doesn't point to a valid field. Tried to access field: {equipped_settingsField}"); } } @@ -95,7 +95,7 @@ public virtual bool Equipped } else { - throw new Exception($"The settings field {StringUtilities.Prettify(nameof(equipped_settingsField))} doesn't point to a valid field"); + throw new Exception($"The settings field {nameof(equipped_settingsField)} doesn't point to a valid field. Tried to access field: {equipped_settingsField}"); } } } @@ -109,7 +109,7 @@ public virtual bool NewlyCollected } else { - throw new Exception($"The settings field {StringUtilities.Prettify(nameof(newlyCollected_settingsField))} doesn't point to a valid field"); + throw new Exception($"The settings field {nameof(newlyCollected_settingsField)} doesn't point to a valid field. Tried to access field: {newlyCollected_settingsField}"); } } @@ -121,7 +121,7 @@ public virtual bool NewlyCollected } else { - throw new Exception($"The settings field {StringUtilities.Prettify(nameof(newlyCollected_settingsField))} doesn't point to a valid field"); + throw new Exception($"The settings field {nameof(newlyCollected_settingsField)} doesn't point to a valid field. Tried to access field: {newlyCollected_settingsField}"); } } } diff --git a/WeaverCore/Utilities/CharmUtilities.cs b/WeaverCore/Utilities/CharmUtilities.cs index 567b33de..5dc33f12 100644 --- a/WeaverCore/Utilities/CharmUtilities.cs +++ b/WeaverCore/Utilities/CharmUtilities.cs @@ -303,11 +303,13 @@ private static string ModHooks_LanguageGetHook(string key, string sheetTitle, st public static bool GiveCharmToPlayer(IWeaverCharm charm, bool displayCollectMessage = true) { + //WeaverLog.Log($"GIVING CHARM {charm} to player"); return GiveCharmToPlayer(GetCustomCharmID(charm), displayCollectMessage); } public static bool GiveCharmToPlayer(int charmID, bool displayCollectMessage = true) { + //WeaverLog.Log($"GIVING CHARM ID {charmID} to player"); bool alreadyCollected = false; if (PlayerData.instance.GetBool($"gotCharm_{charmID}") == true) { @@ -318,6 +320,10 @@ public static bool GiveCharmToPlayer(int charmID, bool displayCollectMessage = t GameManager.instance.IncrementPlayerDataInt("charmsOwned"); } + //WeaverLog.Log("ALREADY COLLECTED = " + alreadyCollected); + + //WeaverLog.Log("HAS CHARM = " + GameManager.instance.GetPlayerDataBool($"gotCharm_{charmID}")); + PlayerData.instance.SetBool($"gotCharm_{charmID}", true); GameManager.instance.StoryRecord_acquired($"gotCharm_{charmID}"); @@ -328,8 +334,13 @@ public static bool GiveCharmToPlayer(int charmID, bool displayCollectMessage = t if (displayCollectMessage) { + //WeaverLog.Log("SPAWNING COLLECT MESSAGE"); ItemGetMessage.SpawnCharm(charmID); } + //else + //{ + //WeaverLog.Log("NOT SPAWNING COLLECT MESSAGE"); + //} return alreadyCollected; } } diff --git a/WeaverCore/Utilities/RendererUtilities.cs b/WeaverCore/Utilities/RendererUtilities.cs new file mode 100644 index 00000000..968c9cb0 --- /dev/null +++ b/WeaverCore/Utilities/RendererUtilities.cs @@ -0,0 +1,114 @@ +using System.Collections; +using System.Collections.Generic; +using TMPro; +using UnityEngine; +using UnityEngine.UI; + +namespace WeaverCore.Utilities +{ + public static class RendererUtilities + { + public interface IColorable + { + UnityEngine.Component BackingComponent {get;} + Color color {get; set;} + } + + public class SpriteColorable : IColorable + { + public readonly SpriteRenderer BackingRenderer; + public SpriteColorable(SpriteRenderer renderer) + { + BackingRenderer = renderer; + } + + public Component BackingComponent => BackingRenderer; + + public Color color { get => BackingRenderer.color; set => BackingRenderer.color = color; } + } + + public class GraphicColorable : IColorable + { + public readonly Graphic BackingGraphic; + public GraphicColorable(Graphic graphic) + { + BackingGraphic = graphic; + } + + public Component BackingComponent => BackingGraphic; + + public Color color { get => BackingGraphic.color; set => BackingGraphic.color = color; } + } + + public class RendererColorable : IColorable + { + public readonly Renderer BackingRenderer; + public RendererColorable(Renderer renderer) + { + BackingRenderer = renderer; + } + + public Component BackingComponent => BackingRenderer; + + public Color color + { + get + { + if (BackingRenderer.sharedMaterial.HasProperty("_Color")) + { + return BackingRenderer.sharedMaterial.GetColor("_Color"); + } + else + { + return BackingRenderer.sharedMaterial.GetColor("_FaceColor"); + } + + } + set + { + if (BackingRenderer.sharedMaterial.HasProperty("_Color")) + { + BackingRenderer.sharedMaterial.SetColor("_Color", color); + } + else + { + BackingRenderer.sharedMaterial.SetColor("_FaceColor", color); + } + // + } + } + } + + public static IEnumerable GetObjectColorables(GameObject obj) + { + return GetObjectColorables(obj.GetComponents()); + } + + public static IEnumerable GetObjectColorableInChildren(GameObject obj) + { + return GetObjectColorables(obj.GetComponentsInChildren()); + } + + public static IEnumerable GetObjectColorables(IEnumerable components) + { + foreach (var c in components) + { + if (c is SpriteRenderer sr) + { + //WeaverLog.Log("FOUND SPRITE COLORABLE = " + sr); + yield return new SpriteColorable(sr); + } + else if (c is Graphic g) + { + //WeaverLog.Log("FOUND GRAPHIC COLORABLE = " + g); + yield return new GraphicColorable(g); + } + else if (c is Renderer r) + { + //WeaverLog.Log("FOUND RENDERERABLE COLORABLE = " + r); + yield return new RendererColorable(r); + } + } + } + } +} diff --git a/WeaverCore/Utilities/RendererUtilities.cs.meta b/WeaverCore/Utilities/RendererUtilities.cs.meta new file mode 100644 index 00000000..69fca1c1 --- /dev/null +++ b/WeaverCore/Utilities/RendererUtilities.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c415725c8ef24d7f69a73520faf3f315 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WeaverCore/Utilities/TypeUtilities.cs b/WeaverCore/Utilities/TypeUtilities.cs index c0dded07..de865369 100644 --- a/WeaverCore/Utilities/TypeUtilities.cs +++ b/WeaverCore/Utilities/TypeUtilities.cs @@ -7,10 +7,11 @@ namespace WeaverCore.Utilities { - /// - /// Contains utility functions related to types - /// - public static class TypeUtilities + + /// + /// Contains utility functions related to types + /// + public static class TypeUtilities { static Cache<(string tName, string aName), Type> typeCache = new Cache<(string tName, string aName), Type>(); diff --git a/WeaverCore/WeaverAssets/Components/Map/ItemGetMessage.cs b/WeaverCore/WeaverAssets/Components/Map/ItemGetMessage.cs index 46ad99bd..581197ee 100644 --- a/WeaverCore/WeaverAssets/Components/Map/ItemGetMessage.cs +++ b/WeaverCore/WeaverAssets/Components/Map/ItemGetMessage.cs @@ -1,4 +1,7 @@ -using System.Collections; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; using TMPro; using UnityEngine; using UnityEngine.UI; @@ -38,6 +41,9 @@ public class ItemGetMessage : MonoBehaviour [SerializeField] private float showTime = 4.25f; + [NonSerialized] + List colorables; + /// /// Gets or sets the icon of the item. /// @@ -89,8 +95,10 @@ public string Text private void Awake() { + colorables = RendererUtilities.GetObjectColorables(gameObject.GetComponentsInChildren().Where(c => c is SpriteRenderer || c is TextMeshPro)).ToList(); + _icon.transform.localScale = Vector3.one; - EventManager.BroadcastEvent("DESTROY JOURNAL MSG", gameObject); + //EventManager.BroadcastEvent("DESTROY JOURNAL MSG", gameObject); listener = GetComponent(); listener.ListenForEvent("DESTROY JOURNAL MSG", (source, destination) => { @@ -141,11 +149,12 @@ public void ShowInstant() StopCoroutine(fadeRoutine); } - var graphics = GetComponentsInChildren(); + //var graphics = GetComponentsInChildren(); + //var colorables = RendererUtilities.GetObjectColorableInChildren(gameObject).ToArray(); //GetComponentsInChildren(); - foreach (var graphic in graphics) + foreach (var colorable in colorables) { - graphic.color = graphic.color.With(a: 1f); + colorable.color = colorable.color.With(a: 1f); } } @@ -159,11 +168,12 @@ private void HideInstant() StopCoroutine(fadeRoutine); } - var graphics = GetComponentsInChildren(); + //var graphics = GetComponentsInChildren(); + //var colorables = RendererUtilities.GetObjectColorableInChildren(gameObject).ToArray(); - foreach (var graphic in graphics) + foreach (var colorable in colorables) { - graphic.color = graphic.color.With(a: 0f); + colorable.color = colorable.color.With(a: 0f); } } @@ -197,14 +207,16 @@ public void Hide() /// private IEnumerator ShowRoutine() { - var graphics = GetComponentsInChildren(); + //var graphics = GetComponentsInChildren(); + //var colorables = RendererUtilities.GetObjectColorableInChildren(gameObject).ToArray(); for (float t = 0; t < upTime; t += Time.deltaTime) { - foreach (var graphic in graphics) + foreach (var colorable in colorables) { - graphic.color = graphic.color.With(a: Mathf.Lerp(0f, 1f, t / upTime)); + colorable.color = colorable.color.With(a: Mathf.Lerp(0f, 1f, t / upTime)); } + //WeaverLog.Log("A:SETTING ALPHA TO = " + Mathf.Lerp(0f, 1f, t / upTime)); yield return null; } } @@ -215,14 +227,15 @@ private IEnumerator ShowRoutine() /// private IEnumerator HideRoutine() { - var graphics = GetComponentsInChildren(); - + //var graphics = GetComponentsInChildren(); + //var colorables = RendererUtilities.GetObjectColorableInChildren(gameObject).ToArray(); for (float t = 0; t < downTime; t += Time.deltaTime) { - foreach (var graphic in graphics) + foreach (var colorable in colorables) { - graphic.color = graphic.color.With(a: Mathf.Lerp(1f, 0f, t / downTime)); + colorable.color = colorable.color.With(a: Mathf.Lerp(1f, 0f, t / downTime)); } + //WeaverLog.Log("B:SETTING ALPHA TO = " + Mathf.Lerp(1f, 0f, t / downTime)); yield return null; } yield break; @@ -283,6 +296,7 @@ public static ItemGetMessage Spawn(Sprite itemSprite, string itemText) var instance = GameObject.Instantiate(prefab.Value).GetComponent(); instance.Icon = itemSprite; instance.Text = itemText; + instance.HideInstant(); return instance; } }