using Snxxz.UI;
using UnityEngine;
using UnityEngine.Events;
public class GA_NpcClientFightBoss : GA_NpcClientFightNorm
{
///
/// 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);
if (NpcConfig.AIType == 186)// 封魔坛boss
{
m_AIHandler = new AI_BossFMT(this, BornPos);
}
else
{
m_AIHandler = new AI_BossDSX(this, BornPos);
}
}
public override void OnSelect()
{
SelectionManager.Request(SelectionManager.E_Type.Red, this);
if (s_OnSelect != null)
{
s_OnSelect(ServerInstID, NpcConfig.NPCID, true);
}
}
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 OnUnSelect()
{
SelectionManager.Release(SelectionManager.E_Type.Red);
if (s_OnSelect != null)
{
s_OnSelect(ServerInstID, NpcConfig.NPCID, false);
}
}
public override void RefreshLifeBar(uint value)
{
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;
}
}
}