From f170c46b55c788000001ff7fe7c8331774f513bb Mon Sep 17 00:00:00 2001 From: Adrian Paschkowski <git@wasdennnoch.me> Date: Thu, 15 Apr 2021 12:15:25 +0200 Subject: [PATCH] Configurable round button colors --- Assets/Scenes/Forest.unity | 4 +++- Assets/Scripts/UI/RoundControllerButton.cs | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Assets/Scenes/Forest.unity b/Assets/Scenes/Forest.unity index 4983803..d808a60 100644 --- a/Assets/Scenes/Forest.unity +++ b/Assets/Scenes/Forest.unity @@ -1088,7 +1088,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0.030816197, g: 0.9150943, b: 0, a: 1} + m_Color: {r: 0.56078434, g: 1, b: 0, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -1127,6 +1127,8 @@ MonoBehaviour: m_EditorClassIdentifier: stopSprite: {fileID: 21300000, guid: f050b492e03119344b04cf01a3486662, type: 3} startSprite: {fileID: 21300000, guid: d42cfe7bed8439c439378d1a7e76f4e3, type: 3} + stopColor: {r: 1, g: 0.15016605, b: 0, a: 1} + startColor: {r: 0.56052005, g: 1, b: 0, a: 1} --- !u!1 &753700734 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/UI/RoundControllerButton.cs b/Assets/Scripts/UI/RoundControllerButton.cs index 22c1540..da86980 100644 --- a/Assets/Scripts/UI/RoundControllerButton.cs +++ b/Assets/Scripts/UI/RoundControllerButton.cs @@ -7,6 +7,7 @@ public class RoundControllerButton : MonoBehaviour, IRoundCallback { [SerializeField] Sprite stopSprite, startSprite; + [SerializeField] Color stopColor = Color.red, startColor = Color.green; Button button; @@ -17,17 +18,19 @@ public class RoundControllerButton : MonoBehaviour, IRoundCallback RoundController.instance.ToggleRound(); }); RoundController.instance.roundCallbacks.Add(this); + OnRoundEnd(); } public void OnRoundEnd() { button.image.sprite = startSprite; - button.image.color = Color.green; + button.image.color = startColor; } public void OnRoundStart() { button.image.sprite = stopSprite; - button.image.color = Color.red; + button.image.color = stopColor; } + } -- GitLab