chenxin
2020-11-28 eafda00b2799204f913a11c835bd9ca7c64dd1e7
Assets/Scripts/TowerDefense/UI/EndlessBossCtrl.cs
@@ -26,11 +26,15 @@
        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)KTGMGemClient.EventType.EndlessBossSkillGlintTitle, Glint);
            EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.EndlessBossSkillGlintTitle, Glint);
        }
        // Update is called once per frame
@@ -39,8 +43,9 @@
        }
        private void Glint()
        private void Glint(int skillType)
        {
            Title.sprite = Resources.Load<Sprite>($"{titlePath}{skillType}");
            //设置一个DOTween队列
            Sequence flashSeq = DOTween.Sequence();
            Color c = Title.color;
@@ -81,6 +86,11 @@
                // 召唤动作结束后自动切换到站立状态
                ChangeState(EndlessBossActionState.Standing);
            }
            else if (frameName == "death")
            {
                BossAnimator.speed = 0;
                EventCenter.Ins.BroadCast((int)EventType.EndlessBossDeathActionEnd);
            }
        }
        /// <summary>
@@ -89,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);
        }
    }
}