From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/Buff/XBuffMob.cs | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Buff/XBuffMob.cs (limited to 'Client/Assets/Scripts/XMainClient/Buff/XBuffMob.cs') diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffMob.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffMob.cs new file mode 100644 index 00000000..5425bb30 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffMob.cs @@ -0,0 +1,79 @@ +using System; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XBuffMob : BuffEffect + { + private XEntity _entity; + + private XEntity _Mob = null; + + private XBuff _Buff; + + private uint _MobTemplateID = 0u; + + public static bool TryCreate(BuffTable.RowData rowData, XBuff buff) + { + bool flag = rowData.MobID == 0u; + bool result; + if (flag) + { + result = false; + } + else + { + buff.AddEffect(new XBuffMob(rowData.MobID, buff)); + result = true; + } + return result; + } + + public XBuffMob(uint templateID, XBuff buff) + { + this._MobTemplateID = templateID; + this._Buff = buff; + } + + public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper) + { + this._entity = entity; + XEntity entity2 = XSingleton.singleton.GetEntity(this._Buff.CasterID); + bool flag = XEntity.ValideEntity(entity2); + if (flag) + { + this._Mob = XSingleton.singleton.CreateEntity(this._MobTemplateID, this._entity.EngineObject.Position, this._entity.EngineObject.Rotation, true, (entity2.Attributes != null) ? entity2.Attributes.FightGroup : uint.MaxValue); + XSingleton.singleton.SetMobProperty(this._Mob, entity2, 0u); + this._Buff.EffectData.MobID = this._Mob.ID; + bool isBoss = entity2.IsBoss; + if (isBoss) + { + XSecurityAIInfo xsecurityAIInfo = XSecurityAIInfo.TryGetStatistics(entity2); + bool flag2 = xsecurityAIInfo != null; + if (flag2) + { + xsecurityAIInfo.OnExternalCallMonster(); + } + } + } + } + + public override void OnRemove(XEntity entity, bool IsReplaced) + { + XSingleton.singleton.DestroyEntity(this._Mob); + this._Mob = null; + } + + public override void OnUpdate() + { + bool flag = !XEntity.ValideEntity(this._Mob); + if (flag) + { + XBuffRemoveEventArgs @event = XEventPool.GetEvent(); + @event.xBuffID = this._Buff.ID; + @event.Firer = this._entity; + XSingleton.singleton.FireEvent(@event); + } + } + } +} -- cgit v1.1-26-g67d0