using vnxbqy.UI;
|
using UnityEngine;
|
using UnityEngine.Events;
|
|
public class GA_NpcFightBoss : GA_NpcFightNorm
|
{
|
/// <summary>
|
/// 1. 实例ID, 2. Npc表ID
|
/// </summary>
|
public static UnityAction<uint, int, bool> s_OnSelect;
|
/// <summary>
|
/// 1. 实例ID, 2. Npc表ID, 3.当前血量, 4. 总血量
|
/// </summary>
|
public static UnityAction<uint, int, ulong, ulong> s_HpRefresh;
|
|
protected override void OnInit(GameNetPackBasic package)
|
{
|
base.OnInit(package);
|
}
|
|
protected sealed override void OnMainModelLoaded()
|
{
|
base.OnMainModelLoaded();
|
|
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);
|
RequestName();
|
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()
|
{
|
if (!MP_Stun)
|
{
|
return;
|
}
|
// 瞎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(ulong value)
|
{
|
var _hero = PlayerDatas.Instance.hero;
|
if ((_hero != null
|
&& _hero.SelectTarget == this)
|
|| ModelCenter.Instance.GetModel<HazyDemonKingModel>().IsInDungeon)
|
{
|
// 非选中状态下不刷新
|
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 > GeneralDefine.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;
|
}
|
|
}
|
public override void RequestName()
|
{
|
ReleaseName();
|
}
|
|
#region Boss类型不需要实现的方法, 覆盖掉父类
|
public sealed override void RequestLifeBar() { }
|
public sealed override void ReleaseLifeBar() { }
|
#endregion
|
}
|