| | |
| | | |
| | | public Text DoubleHitText; |
| | | |
| | | public Image OneTimeKillObj; |
| | | public DoubleHitImg OneTimeKillObj; |
| | | |
| | | public Text OneTimeKillText; |
| | | |
| | |
| | | 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>(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 一次性击杀 |
| | | /// /// 一次性击杀 |
| | | /// </summary> |
| | | /// <param name="count"></param> |
| | | private void OnTimeKill(int count) |
| | | { |
| | | Debug.Log($"--------------------- 一次性击杀个数:{count} ---------------------"); |
| | | if (count >= 10) |
| | | { |
| | | AddScore(500); |
| | | ShowOneTimeKill(10, 500); |
| | | } |
| | | else if (count >= 8) |
| | | { |
| | | AddScore(200); |
| | | ShowOneTimeKill(8, 200); |
| | | } |
| | | else if (count >= 5) |
| | | { |
| | | AddScore(100); |
| | | ShowOneTimeKill(5, 100); |
| | | AddScore(0); |
| | | ShowOneTimeKill(); |
| | | } |
| | | } |
| | | |
| | | 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 |
| | |
| | | else |
| | | remainTime -= Time.deltaTime; |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | // 策划说先写死吧 |
| | | if (DoubleHitCount == 50) |
| | | { |
| | | AddScore(200); |
| | | AddScore(0); |
| | | FloatDoubleHitReward(200); |
| | | } |
| | | else if (DoubleHitCount == 100) |
| | | { |
| | | AddScore(500); |
| | | AddScore(0); |
| | | FloatDoubleHitReward(500); |
| | | } |
| | | else if (DoubleHitCount == 200) |
| | | { |
| | | AddScore(1500); |
| | | AddScore(0); |
| | | FloatDoubleHitReward(1500); |
| | | } |
| | | } |
| | |
| | | DOTween.To(() => canvasGroup.alpha, (float v) => canvasGroup.alpha = v, 0, 0.3f); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 显示一次性击杀飘字 |
| | | /// </summary> |
| | | /// <param name="count"></param> |
| | | /// <param name="score"></param> |
| | | private void ShowOneTimeKill(int count, int score) |
| | | private void ShowOneTimeKill() |
| | | { |
| | | // 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); |
| | | OneTimeKillObj.SetkillCount(); |
| | | } |
| | | |
| | | private void OnShowOneTimeKillComplete() |
| | | { |
| | | // OneTimeKillObj.SetActive(false); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 飘连击奖励分数 |