summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XFootFxComponent.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-25 14:28:30 +0800
committerchai <chaifix@163.com>2021-01-25 14:28:30 +0800
commit6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch)
tree7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/XFootFxComponent.cs
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/XFootFxComponent.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/XFootFxComponent.cs67
1 files changed, 67 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/XFootFxComponent.cs b/Client/Assets/Scripts/XMainClient/XFootFxComponent.cs
new file mode 100644
index 00000000..87e6fe48
--- /dev/null
+++ b/Client/Assets/Scripts/XMainClient/XFootFxComponent.cs
@@ -0,0 +1,67 @@
+using System;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XFootFxComponent : XComponent
+ {
+ public override uint ID
+ {
+ get
+ {
+ return XFootFxComponent.uuID;
+ }
+ }
+
+ public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("FootFx");
+
+ private XGameObject _fx = null;
+
+ public override void OnAttachToHost(XObject host)
+ {
+ base.OnAttachToHost(host);
+ string footFx = XSingleton<XProfessionSkillMgr>.singleton.GetFootFx(XSingleton<XAttributeMgr>.singleton.XPlayerData.BasicTypeID);
+ bool flag = string.IsNullOrEmpty(footFx);
+ if (!flag)
+ {
+ this._fx = XGameObject.CreateXGameObject(footFx, true, true);
+ this._fx.SetParent(this._entity.MoveObj);
+ this._fx.SetLocalPRS(Vector3.zero, true, Quaternion.identity, true, Vector3.one, false);
+ }
+ }
+
+ public override void OnDetachFromHost()
+ {
+ bool flag = this._fx != null;
+ if (flag)
+ {
+ XGameObject.DestroyXGameObject(this._fx);
+ this._fx = null;
+ }
+ base.OnDetachFromHost();
+ }
+
+ public override void PostUpdate(float fDeltaT)
+ {
+ Vector3 zero = Vector3.zero;
+ zero.y = (this._entity.StandOn ? 0f : (XSingleton<XScene>.singleton.TerrainY(this._entity.MoveObj.Position) - this._entity.MoveObj.Position.y)) + 0.025f;
+ bool bMounted = this._entity.Attributes.Outlook.state.bMounted;
+ if (bMounted)
+ {
+ zero.y -= 0.9f;
+ }
+ this._fx.SetLocalPRS(zero, true, Quaternion.identity, false, Vector3.one, false);
+ this._fx.Rotation = XSingleton<XCommon>.singleton.RotateToGround(this._entity.MoveObj.Position, this._entity.MoveObj.Forward);
+ }
+
+ public void SetActive(bool active)
+ {
+ bool flag = this._fx != null;
+ if (flag)
+ {
+ this._fx.SetActive(active, "");
+ }
+ }
+ }
+}