|
using vnxbqy.UI;
|
using UnityEngine;
|
|
public class GA_Pet : GActorNpcFight
|
{
|
private H0435_tagPetAppear m_H0435;
|
private HeadUpName m_HeadUpName;
|
|
protected override void OnInit(GameNetPackBasic package)
|
{
|
base.OnInit(package);
|
|
m_H0435 = package as H0435_tagPetAppear;
|
|
if (m_H0435 == null)
|
{
|
return;
|
}
|
|
ActorInfo.moveSpeed = 1;
|
ActorInfo.ownerSID = m_H0435.PlayerID;
|
ActorInfo.serverBornPos = new Vector2(m_H0435.PosX, m_H0435.PosY);
|
|
AdjustPos((ushort)m_H0435.PosX, (ushort)m_H0435.PosY);
|
|
GActor _parent = GAMgr.Instance.GetBySID(m_H0435.PlayerID);
|
if (_parent != null)
|
{
|
ActorInfo.moveSpeed = _parent.ActorInfo.moveSpeed;
|
}
|
}
|
|
public sealed override void ShowEffect()
|
{
|
HideEffect();
|
|
string _modelName = NpcConfig.MODE;
|
var _config = ModelResConfig.GetPetConfig(_modelName);
|
if (_config != null)
|
{
|
var _boneList = ModelResConfig.GetBoneList(_modelName);
|
var _effectlist = ModelResConfig.GetEffectList(_modelName);
|
|
if (_boneList != null && _effectlist != null)
|
{
|
for (int i = 0; i < _boneList.Count; ++i)
|
{
|
if (_boneList[i].Equals("null"))
|
{
|
var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_effectlist[i], m_Model.transform);
|
m_EffectList.Add(_ctrl);
|
}
|
else
|
{
|
var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_effectlist[i], m_Model.transform.GetChildTransformDeeply(_boneList[i]));
|
m_EffectList.Add(_ctrl);
|
}
|
}
|
}
|
}
|
}
|
|
protected sealed override void OnMainModelLoaded()
|
{
|
base.OnMainModelLoaded();
|
|
uint _parentSID = ServerInstID / 10;
|
|
if (_parentSID != PlayerDatas.Instance.PlayerId)
|
{
|
GA_Player _player = GAMgr.Instance.GetBySID(_parentSID) as GA_Player;
|
|
bool _showOrHide = true;
|
int _index = -999;
|
|
if (_player == null)
|
{
|
_showOrHide = false;
|
}
|
else
|
{
|
_showOrHide = _player.ShowOrHide;
|
if (_showOrHide)
|
{
|
_index = BattleEffectPlayRule.Instance.GetIndex(_parentSID);
|
_showOrHide = _index != -1 && _index < BattleEffectPlayRule.Instance.petLimit;
|
}
|
}
|
|
if (!_showOrHide)
|
{
|
ShowOrHideModel(_showOrHide);
|
}
|
}
|
else
|
{
|
ShowEffect();
|
}
|
|
if (m_H0435 != null && m_H0435.Rank > 0)
|
{
|
var _model = ModelCenter.Instance.GetModel<PetModel>();
|
int _effectID = _model.GetPetHorseEffect(NpcConfig.NPCID, m_H0435.Rank);
|
if (_effectID > 0)
|
{
|
var _bindNode = Root;
|
var _bindNodeName = _model.GetPetHorseEffectNode(NpcConfig.NPCID, m_H0435.Rank);
|
if (!string.IsNullOrEmpty(_bindNodeName))
|
{
|
_bindNode = Root.GetChildTransformDeeply(_bindNodeName);
|
}
|
var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_effectID, _bindNode);
|
m_EffectList.Add(_ctrl);
|
}
|
}
|
}
|
|
public sealed override void ShowOrHideModel(bool showOrHide)
|
{
|
base.ShowOrHideModel(showOrHide);
|
|
if (showOrHide)
|
{
|
ShowEffect();
|
}
|
else
|
{
|
HideEffect();
|
}
|
}
|
|
public sealed override void RequestLifeBar() { }
|
public sealed override void ReleaseLifeBar() { }
|
public sealed override void RefreshLifeBar(ulong value)
|
{
|
//#if UNITY_EDITOR
|
// UnityEditor.EditorApplication.isPaused = true;
|
// UnityEngine.Debug.LogFormat("<color=red>异常的宠物刷新血量逻辑, 速速 @朝黄 .</color>");
|
// UnityEngine.Debug.LogWarningFormat("<color=red>异常的宠物刷新血量逻辑, 速速 @朝黄 .</color>");
|
// UnityEngine.Debug.LogErrorFormat("<color=red>异常的宠物刷新血量逻辑, 速速 @朝黄 .</color>");
|
//#endif
|
}
|
|
public sealed override void RequestName() { }
|
public sealed override void ReleaseName() { }
|
public sealed override void RequestDialogueBubble()
|
{
|
// 非自己的宠物出现不BB
|
if (ActorInfo.ownerSID != PlayerDatas.Instance.PlayerId)
|
{
|
return;
|
}
|
|
// 否则有出现BB逻辑
|
if (m_DialogAppear)
|
{
|
NPCDialogueBubble.Recyle(m_DialogAppear);
|
}
|
}
|
|
protected override void UpdateTimeDialogueBubble()
|
{
|
if (!MP_Name)
|
{
|
return;
|
}
|
// 瞎BB逻辑
|
if (Time.realtimeSinceStartup - m_LastTalkTime > 5)
|
{
|
if (m_DialogTiming != null)
|
{
|
NPCDialogueBubble.Recyle(m_DialogTiming);
|
}
|
m_DialogTiming = NPCDialogueBubble.TimingShow(NpcConfig.NPCID, MP_Name, CameraController.Instance.CameraObject);
|
m_LastTalkTime = Time.realtimeSinceStartup;
|
}
|
}
|
|
protected sealed override void OnUpdate() { }
|
protected sealed override void OnLateUpdate() { }
|
protected sealed override void OnFixedUpdate()
|
{
|
// 非自己的宠物出现不BB
|
if (ActorInfo.ownerSID != PlayerDatas.Instance.PlayerId)
|
{
|
return;
|
}
|
|
// 宠物瞎BB逻辑
|
if (Time.realtimeSinceStartup - m_LastTalkTime > 5)
|
{
|
if (m_DialogTiming != null)
|
{
|
NPCDialogueBubble.Recyle(m_DialogTiming);
|
}
|
m_DialogTiming = NPCDialogueBubble.TimingShow(NpcConfig.NPCID, MP_Name, CameraController.Instance.CameraObject);
|
m_LastTalkTime = Time.realtimeSinceStartup;
|
}
|
}
|
|
public sealed override bool CanAtked()
|
{
|
return false;
|
}
|
|
public sealed override bool CanAtkedRotate()
|
{
|
return false;
|
}
|
|
public sealed override bool CanPushedBack()
|
{
|
return false;
|
}
|
|
public sealed override bool CanHurted()
|
{
|
return false;
|
}
|
|
public sealed override bool CanDieFly()
|
{
|
return false;
|
}
|
|
public sealed override bool CanBeSelected()
|
{
|
return false;
|
}
|
public sealed override void OnSelect()
|
{
|
}
|
public sealed override void OnUnSelect()
|
{
|
}
|
public sealed override void OnClick()
|
{
|
}
|
}
|