From cd4c425959e4a233838b8a764c4742915eeb134e Mon Sep 17 00:00:00 2001 From: JenChieh Date: Sat, 4 May 2024 16:53:12 -0700 Subject: [PATCH] feat(TweenHandler): Add test keys --- .../Scripts/Handler/JCS_TweenerHandler.cs | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/Assets/JCSUnity/Scripts/Handler/JCS_TweenerHandler.cs b/Assets/JCSUnity/Scripts/Handler/JCS_TweenerHandler.cs index a5e39143..6f2ad589 100644 --- a/Assets/JCSUnity/Scripts/Handler/JCS_TweenerHandler.cs +++ b/Assets/JCSUnity/Scripts/Handler/JCS_TweenerHandler.cs @@ -19,9 +19,25 @@ public class JCS_TweenerHandler : MonoBehaviour { /* Variables */ - [Separator("Check Variables (JCS_TweenPanel)")] +#if UNITY_EDITOR + [Separator("Helper Variables (JCS_TweenerHandler)")] - [Tooltip("")] + [Tooltip("Test component with key?")] + [SerializeField] + private bool mTestWithKey = false; + + [Tooltip("Key to active tween to starting value.")] + [SerializeField] + private KeyCode mTweenToStart = KeyCode.J; + + [Tooltip("Key to active tween to target value.")] + [SerializeField] + private KeyCode mTweenToTarget = KeyCode.K; +#endif + + [Separator("Check Variables (JCS_TweenerHandler)")] + + [Tooltip("Optional panel root.")] [SerializeField] [ReadOnly] private JCS_PanelRoot mPanelRoot = null; @@ -73,6 +89,20 @@ private void Start() } } +#if UNITY_EDITOR + private void Update() + { + if (!mTestWithKey) + return; + + if (Input.GetKeyDown(mTweenToStart)) + DoAllTweenToStartValue(); + + if (Input.GetKeyDown(mTweenToTarget)) + DoAllTweenToTargetValue(); + } +#endif + /// /// Check if done tweeening for all tweeners. ///