chenxin
2020-11-19 8ea7726840a84fb53b4fd8a1e5813fbfde5a834e
Assets/Scripts/TowerDefense/UI/EndlessScoreManager.cs
@@ -30,14 +30,14 @@
        public Text DoubleHitText;
        public GameObject OneTimeKillObj;
        public Image OneTimeKillObj;
        public Text OneTimeKillText;
        /// <summary>
        /// 连击的CD时间
        /// </summary>
        private float doubleHitCD = 3f;
        private float doubleHitCD = 0.8f;
        private float remainTime;
@@ -127,7 +127,8 @@
            ++DoubleHitCount;
            openDoubleHit = true;
            DoubleHitText.text = $"{DoubleHitCount}";
            ShowDoubleHit();
            if (DoubleHitCount >= 10)
                ShowDoubleHit();
            remainTime = doubleHitCD;
            // 策划说先写死吧
@@ -180,18 +181,24 @@
        /// <param name="score"></param>
        private void ShowOneTimeKill(int count, int score)
        {
            OneTimeKillText.text = $"{count}连杀 +{score}";
            OneTimeKillObj.transform.localScale = Vector3.zero;
            OneTimeKillObj.SetActive(true);
            CanvasGroup cg = OneTimeKillObj.GetComponent<CanvasGroup>();
            DOTween.To(() => OneTimeKillObj.transform.localScale, (Vector3 v) => OneTimeKillObj.transform.localScale = v, Vector3.one, 0.2f);
            Tween t1 = DOTween.To(() => cg.alpha, (float v) => cg.alpha = v, 0f, 0.2f).SetDelay(2f);
            t1.OnComplete(OnShowOneTimeKillComplete);
            // OneTimeKillText.text = $"{count}连杀 +{score}";
            // OneTimeKillObj.transform.localScale = Vector3.zero;
            // OneTimeKillObj.SetActive(true);
            // CanvasGroup cg = OneTimeKillObj.GetComponent<CanvasGroup>();
            // DOTween.To(() => OneTimeKillObj.transform.localScale, (Vector3 v) => OneTimeKillObj.transform.localScale = v, Vector3.one, 0.2f);
            // Tween t1 = DOTween.To(() => cg.alpha, (float v) => cg.alpha = v, 0f, 0.2f).SetDelay(2f);
            // t1.OnComplete(OnShowOneTimeKillComplete);
            Image obj = Instantiate(OneTimeKillObj);
            obj.transform.SetParent(GameObject.Find("Panel").transform, false);
            obj.sprite = Resources.Load<Sprite>($"UI/DoubleHit/hit_{count}");
            Animator animator = obj.GetComponent<Animator>();
            AnimatorClipInfo[] animatorClipInfos = animator.GetCurrentAnimatorClipInfo(0);
            Destroy(obj.gameObject, animatorClipInfos[0].clip.length);
        }
        private void OnShowOneTimeKillComplete()
        {
            OneTimeKillObj.SetActive(false);
            // OneTimeKillObj.SetActive(false);
        }
        /// <summary>