From d7cc2eb4decd1cc4993b2d137ff3993f8201313f Mon Sep 17 00:00:00 2001 From: wangguan <wangguan@kt007.com> Date: Wed, 25 Nov 2020 14:24:09 +0800 Subject: [PATCH] 推动BUG 增加金币获得特效 --- Assets/Scripts/TowerDefense/UI/EndlessBossCtrl.cs | 63 ++++++++++++++++++++++++++++++- 1 files changed, 60 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/TowerDefense/UI/EndlessBossCtrl.cs b/Assets/Scripts/TowerDefense/UI/EndlessBossCtrl.cs index b32ece1..d43990c 100644 --- a/Assets/Scripts/TowerDefense/UI/EndlessBossCtrl.cs +++ b/Assets/Scripts/TowerDefense/UI/EndlessBossCtrl.cs @@ -1,6 +1,8 @@ +using DG.Tweening; using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.UI; using Core.Utilities; /** @@ -22,16 +24,54 @@ /// </summary> public EndlessBossActionState ActionState { get; set; } + public Image Title; + + private string titlePath = "UI/Endless/SkillTitle/"; + + public ParticleSystem deadPS, deadMoney; + // Start is called before the first frame update private void Start() { - + ColorVal = 0; + EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.EndlessBossSkillGlintTitle, Glint); } // Update is called once per frame private void Update() { + } + + private void Glint(int skillType) + { + Title.sprite = Resources.Load<Sprite>($"{titlePath}{skillType}"); + //设置一个DOTween队列 + Sequence flashSeq = DOTween.Sequence(); + Color c = Title.color; + c.a = 0; + Title.color = c; + Title.gameObject.SetActive(true); + + flashSeq.Append(DOTween.To(() => ColorVal, (v) => ColorVal = v, 1, 0.3f)); + flashSeq.Append(DOTween.To(() => ColorVal, (v) => ColorVal = v, 0, 0.15f)); + flashSeq.Append(DOTween.To(() => ColorVal, (v) => ColorVal = v, 1, 0.3f)); + flashSeq.Append(DOTween.To(() => ColorVal, (v) => ColorVal = v, 0, 0.15f)); + flashSeq.Append(DOTween.To(() => ColorVal, (v) => ColorVal = v, 1, 0.3f)); + flashSeq.Append(DOTween.To(() => ColorVal, (v) => ColorVal = v, 0, 0.15f)); + flashSeq.AppendCallback(() => { EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessBossSkillGlintTitleCompleted); }); + } + + private float ColorVal + { + get { return Title.color.a; } + set + { + Title.gameObject.SetActive(value != 0); + Color c = Title.color; + c.a = value; + Title.color = c; + } } /// <summary> @@ -43,6 +83,13 @@ if (frameName == "summonEnd") { EventCenter.Ins.BroadCast((int)EventType.EndlessBossSummonEnd); + // 召唤动作结束后自动切换到站立状态 + ChangeState(EndlessBossActionState.Standing); + } + else if (frameName == "death") + { + BossAnimator.speed = 0; + EventCenter.Ins.BroadCast((int)EventType.EndlessBossDeathActionEnd); } } @@ -52,10 +99,20 @@ /// <param name="newState"></param> public void ChangeState(EndlessBossActionState newState) { - if (newState == ActionState) return; - ActionState = newState; + + if (newState == EndlessBossActionState.Standing || newState == EndlessBossActionState.Summon) + BossAnimator.speed = 1; + else if (newState == EndlessBossActionState.Death) + { + //Debug.Log("BOSS死亡特效"); + //播放特效 + deadPS.Play(); + deadMoney.Play(); + } BossAnimator.SetInteger("State", (int)newState); + + } } } \ No newline at end of file -- Gitblit v1.9.1