chenxin
2020-11-27 841b66ef416a727a0c798ad2263b098247cb4aa7
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;
@@ -67,7 +67,7 @@
        private void Start()
        {
            Init();
            EventCenter.Ins.Add<Agent>((int)KTGMGemClient.EventType.EndlessAgentDead, AgentDead);
            EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.EndlessAgentDead, AgentDead);
            EventCenter.Ins.Add((int)KTGMGemClient.EventType.EndlessOneHit, OnHit);
            EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.EndlessOneTimeKillCount, OnTimeKill);
            canvasGroup = DoubleHit.GetComponent<CanvasGroup>();
@@ -97,10 +97,10 @@
            }
        }
        private void AgentDead(Agent agent)
        private void AgentDead(int point)
        {
            if (EndlessGameUI.instance.state == EndlessGameUI.State.GameOver) return;
            AddScore(agent.EnemyData.point);
            AddScore(point);
        }
        // Update is called once per frame
@@ -127,7 +127,8 @@
            ++DoubleHitCount;
            openDoubleHit = true;
            DoubleHitText.text = $"{DoubleHitCount}";
            ShowDoubleHit();
            if (DoubleHitCount >= 10)
                ShowDoubleHit();
            remainTime = doubleHitCD;
            // 策划说先写死吧
@@ -180,18 +181,10 @@
        /// <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);
        }
        private void OnShowOneTimeKillComplete()
        {
            OneTimeKillObj.SetActive(false);
            Image obj = Instantiate(OneTimeKillObj);
            obj.transform.SetParent(GameObject.Find("Panel").transform, false);
            obj.sprite = Resources.Load<Sprite>($"UI/DoubleHit/hit_{count}");
            Destroy(obj.gameObject, 2.05f);
        }
        /// <summary>