using Snxxz.UI; using UnityEngine; using UnityEngine.Events; public class GA_NpcFightBoss : GA_NpcFightNorm { /// /// 1. 实例ID, 2. Npc表ID /// public static UnityAction s_OnSelect; /// /// 1. 实例ID, 2. Npc表ID, 3.当前血量, 4. 总血量 /// public static UnityAction s_HpRefresh; protected override void OnInit(GameNetPackBasic package) { base.OnInit(package); } protected sealed override void OnAfterInit() { base.OnAfterInit(); GA_Hero _hero = PlayerDatas.Instance.hero; if (_hero != null) { destForward = Forward = MathUtility.ForwardXZ(_hero.Pos, Pos); } } public sealed override void OnSelect() { if (ActorInfo.serverDie) { return; } SelectionManager.Request(SelectionManager.E_Type.Red, this); if (s_OnSelect != null) { s_OnSelect(ServerInstID, NpcConfig.NPCID, true); } } public sealed override void OnUnSelect() { SelectionManager.Release(SelectionManager.E_Type.Red); if (s_OnSelect != null) { s_OnSelect(ServerInstID, NpcConfig.NPCID, false); } } public sealed override void RequestDialogueBubble() { if (m_DialogAppear) { NPCDialogueBubble.Recyle(m_DialogAppear); } } protected override sealed void UpdateTimeDialogueBubble() { // 瞎BB逻辑 if (Time.realtimeSinceStartup - m_LastTalkTime > 5) { if (m_DialogTiming != null) { NPCDialogueBubble.Recyle(m_DialogTiming); } m_DialogTiming = NPCDialogueBubble.TimingShow(NpcConfig.NPCID, MP_Stun, CameraController.Instance.CameraObject); m_LastTalkTime = Time.realtimeSinceStartup; } } public override void RefreshLifeBar(uint value) { // 非选中状态下不刷新 if (PlayerDatas.Instance.hero != null) { if (PlayerDatas.Instance.hero.SelectTarget != this) { return; } } if (s_HpRefresh != null) { s_HpRefresh(ServerInstID, NpcConfig.NPCID, ActorInfo.RealHp, ActorInfo.RealMaxHp); } } private float m_LastPlayTime; public sealed override void PlayHurtAudio(GActorFight attacker) { base.PlayHurtAudio(attacker); if (Time.time - m_LastPlayTime > GeneralConfig.Instance.PlayBossHurtInterval) { if (m_AudioSource) { if (NpcConfig.Sounds != null) { if (NpcConfig.Sounds.Length > 1) { SoundPlayer.Instance.PlayAudio(m_AudioSource, NpcConfig.Sounds[1]); } } } m_LastPlayTime = Time.time; } } #region Boss类型不需要实现的方法, 覆盖掉父类 public sealed override void RequestLifeBar() { } public sealed override void ReleaseLifeBar() { } public sealed override void RequestName() { } public sealed override void ReleaseName() { } #endregion }