コード例 #1
0
        public void StartCountDown(Action onEndCountDown, Action onNoThanks)
        {
            if (countDownCoroutine != null)
            {
                StopCoroutine(countDownCoroutine);
            }

            noThanksButton.OnClickEvent.RemoveAllListeners();
            noThanksButton.AddListener(() =>
            {
                if (onNoThanks != null)
                {
                    onNoThanks.Invoke();
                }
            });

            countDownCoroutine = StartCoroutine(KKUtilities.FloatLerp(timeLimit, (t) =>
            {
                timeLimitGauge.Image.fillAmount = 1.0f - t;
            }).OnCompleted(() =>
            {
                if (onEndCountDown != null)
                {
                    onEndCountDown.Invoke();
                }
                gameObject.SetActive(false);
                countDownCoroutine = null;
            }));
        }
コード例 #2
0
        public static Coroutine Fade(this UGUIParts self, float duration, float targetAlpha)
        {
            var startAlpha = self.Alpha;

            return(self.StartCoroutine(KKUtilities.FloatLerp(duration, (t) =>
            {
                self.Alpha = Mathf.Lerp(startAlpha, targetAlpha, Easing.InQuad(t));
            })));
        }
コード例 #3
0
        public static Coroutine LocalMove(this MonoBehaviour mono, float duration, Vector3 targetPos, EaseType ease, bool isScalable = true)
        {
            Vector3 startPos = mono.transform.localPosition;

            return(mono.StartCoroutine(KKUtilities.FloatLerp(duration, (t) =>
            {
                mono.transform.localPosition = Vector3.LerpUnclamped(startPos, targetPos, Easing.GetEase(t, ease));
            }, isScalable)));
        }
コード例 #4
0
 public static Coroutine PopUp(this UGUIParts self, float duration)
 {
     self.transform.localScale = Vector3.zero;
     self.gameObject.SetActive(true);
     return(self.StartCoroutine(KKUtilities.FloatLerp(duration, (t) =>
     {
         self.transform.localScale = Vector3.LerpUnclamped(Vector3.zero, Vector3.one, Easing.OutBack(t));
     })));
 }
コード例 #5
0
 protected override IEnumerator TutorialAnimation()
 {
     while (true)
     {
         yield return(KKUtilities.FloatLerp(speed, (t) =>
         {
             fingerImage.RectTransform.anchoredPosition = Vector2.LerpUnclamped(startPoint.anchoredPosition, endPoint.anchoredPosition, curve.Evaluate(t));
         }));
     }
 }
コード例 #6
0
ファイル: ConfigMenu.cs プロジェクト: aguroshou/Repair
        public void HideMenu()
        {
            StopAllCoroutines();

            StartCoroutine(KKUtilities.FloatLerp(0.3f, (t) =>
            {
                container.alpha = Mathf.Lerp(1.0f, 0.0f, t);
            }).OnCompleted(() =>
            {
                container.gameObject.SetActive(false);
            }));
        }
コード例 #7
0
ファイル: TapTutorialPanel.cs プロジェクト: aguroshou/Repair
        protected override IEnumerator TutorialAnimation()
        {
            float maxScale = 1.2f;

            while (true)
            {
                yield return(KKUtilities.FloatLerp(speed, (t) =>
                {
                    fingerImage.transform.localScale = Vector3.Lerp(Vector3.one, Vector3.one * maxScale, curve.Evaluate(t));
                }));
            }
        }
コード例 #8
0
 void ChangeVolume(float startVolume, float endVolume, float duration, Action callback = null)
 {
     StartCoroutine(KKUtilities.FloatLerp(duration, (t) =>
     {
         Volume = Mathf.Lerp(startVolume, endVolume, t);
     }).OnCompleted(() =>
     {
         if (callback != null)
         {
             callback.Invoke();
         }
     }));
 }
コード例 #9
0
        public virtual void Hide()
        {
            StartCoroutine(KKUtilities.FloatLerp(showAnimationTime * 0.5f, (t) =>
            {
                panel.Alpha = Mathf.Lerp(panel.DefaultAlpha, 0.0f, Easing.OutQuad(t));
            }));

            StartCoroutine(hideAnimation.GetAnimation(this, hideAnimationTime).OnCompleted(() =>
            {
                panel.gameObject.SetActive(false);
                Container.SetActive(false);
                OnHideAnimationEnd.Invoke();
            }));
        }
コード例 #10
0
        IEnumerator NotificationAnimation()
        {
            var wait = new WaitForSeconds(0.75f);

            while (true)
            {
                yield return(KKUtilities.FloatLerp(2.0f, (t) =>
                {
                    transform.localScale = Vector3.LerpUnclamped(Vector3.one, Vector3.one * 1.2f, scaleCurve.Evaluate(t));
                }));

                yield return(wait);
            }
        }
コード例 #11
0
        public virtual void Show()
        {
            panel.gameObject.SetActive(true);
            Container.SetActive(true);
            Alpha = 1;
            StartCoroutine(KKUtilities.FloatLerp(showAnimationTime * 0.5f, (t) =>
            {
                panel.Alpha = Mathf.Lerp(0.0f, panel.DefaultAlpha, Easing.InQuad(t));
            }));

            StartCoroutine(showAnimation.GetAnimation(this, showAnimationTime).OnCompleted(() =>
            {
                OnShowAnimationEnd.Invoke();
            }));
        }
コード例 #12
0
        protected override void OnClick()
        {
            Button.interactable = false;
            Vector3 startPos = buttonImage.transform.position;
            Vector3 endPos   = shadowImage.transform.position;

            StartCoroutine(KKUtilities.FloatLerp(0.15f, (t) =>
            {
                buttonImage.transform.position = Vector3.Lerp(startPos, endPos, Easing.Yoyo(t));
            }, false).OnCompleted(() =>
            {
                base.OnClick();
                Button.interactable = true;
            }));
        }
コード例 #13
0
        IEnumerator Fade(Color startColor, Color endColor, float duration, Action endCallback, bool finishedPanelActive)
        {
            panel.color = startColor;
            panel.gameObject.SetActive(true);

            yield return(StartCoroutine(KKUtilities.FloatLerp(duration, (t) =>
            {
                panel.color = Color.Lerp(startColor, endColor, t);
            })
                                        ));

            fadeCoroutine = null;
            panel.gameObject.SetActive(finishedPanelActive);
            if (endCallback != null)
            {
                endCallback.Invoke();
            }
        }
コード例 #14
0
        void ChangeStateAnimation()
        {
            StopAllCoroutines();
            var start = circle.RectTransform.anchoredPosition;
            var end   = IsOn ? selectedCirclePosition : unSelectedCirclePosition;

            if (!gameObject.activeInHierarchy)
            {
                Refresh();
                return;
            }

            AudioManager.Instance.PlaySE("Click", 0.3f);
            StartCoroutine(KKUtilities.FloatLerp(0.15f, (t) =>
            {
                circle.RectTransform.anchoredPosition = Vector2.Lerp(start, end, Easing.OutQuad(t));
            }).OnCompleted(() =>
            {
                Refresh();
            }));
        }
コード例 #15
0
 public MyCoroutine GetAnimation(UIParts parts, float duration)
 {
     return(new MyCoroutine(KKUtilities.FloatLerp(duration, (t) => logic(parts, t))));
 }
コード例 #16
0
 /// <summary>
 /// 与えられたActionにduration秒かけて0→1になる値を毎フレーム渡す
 /// </summary>
 public static Coroutine FloatLerp(this MonoBehaviour mono, float duration, Action <float> action, bool isScalable = true)
 {
     return(mono.StartCoroutine(KKUtilities.FloatLerp(duration, action, isScalable)));
 }