diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs new file mode 100644 index 00000000..dc3028d1 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs @@ -0,0 +1,73 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffManipulate : BuffEffect
+ {
+ private XEntity _entity;
+
+ private XBuff _Buff;
+
+ private long _Token;
+
+ public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
+ {
+ bool flag = rowData.Manipulate == null || rowData.Manipulate.Length == 0;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffManipulate(buff));
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffManipulate(XBuff buff)
+ {
+ this._Buff = buff;
+ }
+
+ private float _GetParam(int index)
+ {
+ bool flag = this._Buff.BuffInfo.Manipulate == null || this._Buff.BuffInfo.Manipulate.Length <= index;
+ float result;
+ if (flag)
+ {
+ result = 0f;
+ }
+ else
+ {
+ result = this._Buff.BuffInfo.Manipulate[index];
+ }
+ return result;
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ this._entity = entity;
+ XManipulationData xmanipulationData = new XManipulationData();
+ xmanipulationData.Degree = 360f;
+ xmanipulationData.Force = this._GetParam(0);
+ xmanipulationData.Radius = this._GetParam(1);
+ xmanipulationData.TargetIsOpponent = ((int)this._GetParam(2) == 0);
+ XManipulationOnEventArgs @event = XEventPool<XManipulationOnEventArgs>.GetEvent();
+ @event.data = xmanipulationData;
+ @event.Firer = this._entity;
+ this._Token = @event.Token;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ XManipulationOffEventArgs @event = XEventPool<XManipulationOffEventArgs>.GetEvent();
+ @event.DenyToken = this._Token;
+ @event.Firer = entity;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+ }
+}
|