From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Assets/Scripts/XMainClient/XFootFxComponent.cs | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XFootFxComponent.cs (limited to 'Client/Assets/Scripts/XMainClient/XFootFxComponent.cs') 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.singleton.XHash("FootFx"); + + private XGameObject _fx = null; + + public override void OnAttachToHost(XObject host) + { + base.OnAttachToHost(host); + string footFx = XSingleton.singleton.GetFootFx(XSingleton.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.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.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, ""); + } + } + } +} -- cgit v1.1-26-g67d0