summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XFootFxComponent.cs
blob: 87e6fe489e0846d24988222ae0080eeeac940ff8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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, "");
			}
		}
	}
}