summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XEditor/XSkillEditor
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/XEditor/XSkillEditor
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XEditor/XSkillEditor')
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/Effect.meta5
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/Effect/ImageEffectBase.cs56
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/Effect/ImageEffectBase.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/Effect/RadialBlur.cs49
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/Effect/RadialBlur.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XBullet.cs443
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XBullet.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XBulletData.cs85
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XBulletData.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs34
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XCameraShake.cs157
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XCameraShake.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XDataBuilder.cs347
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XDataBuilder.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XDataIO.cs95
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XDataIO.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XEditorData.cs695
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XEditorData.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XEditorPath.cs85
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XEditorPath.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XGesture.cs205
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XGesture.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XSerialized.cs70
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XSerialized.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCamera.cs389
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCamera.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCharge.cs200
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCharge.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHit.cs545
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHit.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHoster.cs2081
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHoster.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XSkillManipulate.cs65
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XSkillManipulate.cs.meta8
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XTouch.cs130
-rw-r--r--Client/Assets/Scripts/XEditor/XSkillEditor/XTouch.cs.meta8
37 files changed, 5880 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/Effect.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/Effect.meta
new file mode 100644
index 00000000..7692e7f6
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/Effect.meta
@@ -0,0 +1,5 @@
+fileFormatVersion: 2
+guid: a50e3f493c054284ba34989bde5e2806
+folderAsset: yes
+DefaultImporter:
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/Effect/ImageEffectBase.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/Effect/ImageEffectBase.cs
new file mode 100644
index 00000000..bf9e66e2
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/Effect/ImageEffectBase.cs
@@ -0,0 +1,56 @@
+#if UNITY_EDITOR
+using UnityEngine;
+
+[RequireComponent (typeof(Camera))]
+[AddComponentMenu("")]
+public class ImageEffectBase : MonoBehaviour {
+ /// Provides a shader property that is set in the inspector
+ /// and a material instantiated from the shader
+ public Shader m_shader;
+ private Material m_Material;
+ protected string m_shaderName = "Mobile/Diffuse";
+ protected virtual void Start ()
+ {
+ // Disable if we don't support image effects
+ if (!SystemInfo.supportsImageEffects) {
+ enabled = false;
+ return;
+ }
+
+ // Disable the image effect if the shader can't
+ // run on the users graphics card
+ if (!shader || !shader.isSupported)
+ enabled = false;
+ }
+ public virtual Shader shader
+ {
+ get
+ {
+ if (m_shader == null)
+ {
+ m_shader = Shader.Find(m_shaderName);
+ }
+ return m_shader;
+ }
+ set
+ {
+ m_shader = value;
+ }
+ }
+ protected Material material {
+ get {
+ if (m_Material == null) {
+ m_Material = new Material (shader);
+ m_Material.hideFlags = HideFlags.HideAndDontSave;
+ }
+ return m_Material;
+ }
+ }
+
+ protected virtual void OnDisable() {
+ if( m_Material ) {
+ DestroyImmediate( m_Material );
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/Effect/ImageEffectBase.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/Effect/ImageEffectBase.cs.meta
new file mode 100644
index 00000000..42c7ce0d
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/Effect/ImageEffectBase.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c965db0de94104d4996defd5df4f006e
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/Effect/RadialBlur.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/Effect/RadialBlur.cs
new file mode 100644
index 00000000..553496bf
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/Effect/RadialBlur.cs
@@ -0,0 +1,49 @@
+#if UNITY_EDITOR
+using UnityEngine;
+
+[ExecuteInEditMode]
+[RequireComponent(typeof(Camera))]
+
+public class RadialBlur : ImageEffectBase
+{
+ public float blurStrength = 6.0f;
+ public float blurWidth = 0.7f;
+
+ void Awake()
+ {
+ enabled = false;
+ m_shaderName = "Hidden/radialBlur";
+ //if (!SystemInfo.supportsRenderTextures)
+ //{
+ // enabled = false;
+ // return;
+ //}
+ }
+ void OnEnable()
+ {
+ }
+ void OnRenderImage(RenderTexture source, RenderTexture dest)
+ {
+ // Create the accumulation texture
+ //if (accumTexture == null || accumTexture.width != source.width || accumTexture.height != source.height)
+ //{
+ // DestroyImmediate(accumTexture);
+ // accumTexture = new RenderTexture(source.width, source.height, 0);
+ // accumTexture.hideFlags = HideFlags.HideAndDontSave;
+ // Graphics.Blit(source, accumTexture);
+ //}
+
+ material.SetTexture("_MainTex", source);
+ material.SetFloat("_BlurStrength", blurStrength);
+ material.SetFloat("_BlurWidth", blurWidth);
+ material.SetFloat("_iHeight", 1);
+ material.SetFloat("_iWidth", 1);
+ //accumTexture.MarkRestoreExpected();
+
+ // Graphics.Blit(source, accumTexture, material);
+ // Graphics.Blit(accumTexture, dest);
+
+ Graphics.Blit(source, dest, material);
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/Effect/RadialBlur.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/Effect/RadialBlur.cs.meta
new file mode 100644
index 00000000..456d3d2c
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/Effect/RadialBlur.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: bd9d2efe45f76fb4d87e90244d34accb
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XBullet.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XBullet.cs
new file mode 100644
index 00000000..f5b0a127
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XBullet.cs
@@ -0,0 +1,443 @@
+#if UNITY_EDITOR
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XEditor
+{
+ internal class XBullet
+ {
+ private struct XBulletTarget
+ {
+ public uint TimerToken;
+ public bool Hurtable;
+ public int HurtCount;
+ }
+
+ private bool _active = true;
+ private bool _pingponged = false;
+ private bool _collided = false;
+
+ private uint _tail_results_token = 0;
+ private int _tail_results = 0;
+
+ private float _elapsed = 0;
+
+ private GameObject _bullet = null;
+ private XBulletData _data = null;
+ private RaycastHit _hitInfo;
+ private Vector3 _origin = Vector3.zero;
+ private XFmod _emitter = null;
+
+ private Dictionary<XSkillHit, XBulletTarget> _hurt_target = new Dictionary<XSkillHit, XBulletTarget>();
+
+ public XBullet(XBulletData data)
+ {
+ _data = data;
+
+ _elapsed = 0.0f;
+
+ GameObject o = Resources.Load(_data.Prefab) as GameObject;
+ _bullet = GameObject.Instantiate(o, _data.BulletRay.origin, _data.Velocity > 0 ? Quaternion.LookRotation(_data.BulletRay.direction) : Quaternion.LookRotation(_data.Firer.transform.forward)) as GameObject;
+
+ _data.Firer.ShownTransform = _bullet.transform;
+
+ if (!string.IsNullOrEmpty(_data.Skill.Result[_data.Sequnce].LongAttackData.Audio))
+ {
+ if (_emitter == null)
+ _emitter = _bullet.AddComponent<XFmod>();
+
+ _emitter.StartEvent("event:/" + _data.Skill.Result[_data.Sequnce].LongAttackData.Audio, _data.Skill.Result[_data.Sequnce].LongAttackData.Audio_Channel);
+ }
+ }
+
+ public bool IsExpired()
+ {
+ if (_tail_results != 0)
+ {
+ if (_tail_results >= _data.Skill.Result[_data.Sequnce].LongAttackData.TriggerAtEnd_Count)
+ return true;
+ else
+ return false;
+ }
+
+ if (_data.Skill.Result[_data.Sequnce].LongAttackData.IsPingPong && !_pingponged)
+ {
+ if (XCommon.singleton.IsGreater(_elapsed, _data.Life)) _pingponged = true;
+ }
+
+ bool expired = (!_active || (!_pingponged && XCommon.singleton.IsGreater(_elapsed, _data.Life)));
+
+ if (_data.Skill.Result[_data.Sequnce].LongAttackData.TriggerAtEnd_Count <= 0)
+ return expired;
+ else
+ {
+ if (expired)
+ {
+ _active = false;
+ OnTailResult(null);
+
+ return false;
+ }
+ else
+ return expired;
+ }
+ }
+
+ public bool IsHurtEntity(XSkillHit id)
+ {
+ XBulletTarget target;
+ if (id != null && _hurt_target.TryGetValue(id, out target))
+ {
+ return !target.Hurtable;
+ }
+ else
+ return false;
+ }
+
+ private void OnTailResult(object o)
+ {
+ if (o == null)
+ {
+ _tail_results = 0;
+ FakeDestroyBulletObject();
+ }
+
+ if (_tail_results < _data.Skill.Result[_data.Sequnce].LongAttackData.TriggerAtEnd_Count)
+ {
+ _tail_results++;
+
+ TailResult(_tail_results == 1);
+
+ XTimerMgr.singleton.KillTimer(_tail_results_token);
+ _tail_results_token = XTimerMgr.singleton.SetTimer(_data.Skill.Result[_data.Sequnce].LongAttackData.TriggerAtEnd_Cycle, OnTailResult, this);
+ }
+ }
+
+ private void TailResult(bool present)
+ {
+ if (_data.Skill.Result[_data.Sequnce].LongAttackData.TriggerAtEnd)
+ {
+ if (_data.Warning) _bullet.transform.position = _data.WarningPos;
+ Result(null);
+ }
+
+ if (!present) return;
+
+ if (_data.Skill.Result[_data.Sequnce].LongAttackData.End_Fx != null && _data.Skill.Result[_data.Sequnce].LongAttackData.End_Fx.Length > 0)
+ {
+ GameObject o = Resources.Load(_data.Skill.Result[_data.Sequnce].LongAttackData.End_Fx) as GameObject;
+ GameObject fx = GameObject.Instantiate(o) as GameObject;
+
+ Vector3 pos = _bullet.transform.position;
+ if (_data.Skill.Result[_data.Sequnce].LongAttackData.EndFx_Ground) pos.y = 0;
+ fx.transform.position = pos;
+ fx.transform.rotation = _bullet.transform.rotation;
+
+ GameObject.Destroy(fx, _data.Skill.Result[_data.Sequnce].LongAttackData.EndFx_LifeTime);
+ }
+
+ if (!string.IsNullOrEmpty(_data.Skill.Result[_data.Sequnce].LongAttackData.End_Audio))
+ {
+ if (_data.Firer.Emitter == null)
+ _data.Firer.Emitter = _bullet.AddComponent<XFmod>();
+
+ _data.Firer.Emitter.Update3DAttributes(_bullet.transform.position, _data.Skill.Result[_data.Sequnce].LongAttackData.End_Audio_Channel);
+ _data.Firer.Emitter.StartEvent("event:/" + _data.Skill.Result[_data.Sequnce].LongAttackData.End_Audio, _data.Skill.Result[_data.Sequnce].LongAttackData.Audio_Channel);
+ }
+
+ if (_data.Firer.ShownTransform == _bullet.transform)
+ _data.Firer.ShownTransform = _data.Firer.transform;
+ }
+
+ private void FakeDestroyBulletObject()
+ {
+ if (null != _bullet)
+ {
+ Vector3 pos = _bullet.transform.position;
+ Quaternion quat = _bullet.transform.rotation;
+
+ GameObject.Destroy(_bullet);
+
+ _bullet = new GameObject("fakeBullet");
+ _bullet.transform.position = pos;
+ _bullet.transform.rotation = quat;
+ _bullet.SetActive(true);
+ }
+ }
+
+ public void Destroy()
+ {
+ XTimerMgr.singleton.KillTimer(_tail_results_token);
+
+ if (_data.Skill.Result[_data.Sequnce].LongAttackData.Type == XResultBulletType.Ring)
+ {
+ _data.Firer.ir = 0;
+ _data.Firer.or = 0;
+ }
+
+ if (_data.Skill.Result[_data.Sequnce].LongAttackData.TriggerAtEnd_Count == 0) TailResult(true);
+
+ if (null != _bullet)
+ {
+ GameObject.Destroy(_bullet);
+ }
+
+ foreach (XBulletTarget bt in _hurt_target.Values)
+ {
+ XTimerMgr.singleton.KillTimer(bt.TimerToken);
+ }
+
+ _bullet = null;
+ _data = null;
+ }
+
+ public bool Collided
+ {
+ get { return _collided; }
+ }
+
+ private void OnRefined(object o)
+ {
+ XBulletTarget bt;
+ XSkillHit id = (XSkillHit)o;
+
+ if (_hurt_target.TryGetValue(id, out bt))
+ {
+ if (bt.HurtCount < _data.Skill.Result[_data.Sequnce].LongAttackData.Refine_Count)
+ {
+ bt.Hurtable = true;
+ _hurt_target[id] = bt;
+ }
+ }
+ }
+
+ public void Result(XSkillHit hit)
+ {
+ if (IsHurtEntity(hit)) return;
+
+ //trigger skill result
+ _data.Firer.innerResult(_data.Sequnce, _bullet.transform.forward, _bullet.transform.position, _data.Skill, hit);
+
+ if (hit != null)
+ {
+ XBulletTarget bt;
+ if (!_hurt_target.TryGetValue(hit, out bt))
+ {
+ bt = new XBulletTarget();
+ _hurt_target.Add(hit, bt);
+ }
+
+ XTimerMgr.singleton.KillTimer(bt.TimerToken);
+
+ bt.Hurtable = false;
+ bt.HurtCount++;
+ bt.TimerToken = _data.Skill.Result[_data.Sequnce].LongAttackData.Refine_Cycle > 0 ?
+ XTimerMgr.singleton.SetTimer(_data.Skill.Result[_data.Sequnce].LongAttackData.Refine_Cycle, OnRefined, hit) :
+ 0;
+
+ _hurt_target[hit] = bt;
+ }
+
+ if (_data.Skill.Result[_data.Sequnce].LongAttackData.TriggerOnce)
+ {
+ if (_data.Skill.Result[_data.Sequnce].LongAttackData.IsPingPong)
+ _pingponged = true;
+ else
+ _active = false;
+ }
+ }
+
+ public void Update(float fDeltaT)
+ {
+ if (!_active) return;
+
+ _elapsed += fDeltaT;
+
+ float dis = 0; Vector3 dir = Vector3.forward;
+
+ switch (_data.Skill.Result[_data.Sequnce].LongAttackData.Type)
+ {
+ case XResultBulletType.Ring:
+ {
+ _bullet.transform.position = _data.Firer.transform.position;
+ }break;
+ case XResultBulletType.Sphere:
+ case XResultBulletType.Plane:
+ {
+ dis = (_elapsed > _data.Runningtime && _elapsed < _data.Life) ? 0 : _data.Velocity * fDeltaT;
+ dir = _bullet.transform.forward;
+ }break;
+ case XResultBulletType.Satellite:
+ {
+ if (_elapsed - fDeltaT == 0)
+ {
+ _bullet.transform.position = _data.Firer.transform.position + _data.BulletRay.direction * _data.Skill.Result[_data.Sequnce].LongAttackData.RingRadius;
+
+ dis = 0;
+ dir = XCommon.singleton.HorizontalRotateVetor3(_data.Firer.transform.forward, _data.Skill.Result[_data.Sequnce].LongAttackData.Palstance < 0 ? -90 : 90);
+ }
+ else
+ {
+ Vector3 curr = XCommon.singleton.HorizontalRotateVetor3(_data.BulletRay.direction, _data.Skill.Result[_data.Sequnce].LongAttackData.Palstance * (_elapsed - fDeltaT)) * _data.Skill.Result[_data.Sequnce].LongAttackData.RingRadius;
+ Vector3 next = XCommon.singleton.HorizontalRotateVetor3(_data.BulletRay.direction, _data.Skill.Result[_data.Sequnce].LongAttackData.Palstance * _elapsed) * _data.Skill.Result[_data.Sequnce].LongAttackData.RingRadius;
+
+ _bullet.transform.rotation = XCommon.singleton.VectorToQuaternion(XCommon.singleton.Horizontal(next - curr));
+
+ next += _data.Firer.transform.position;
+
+ Vector3 d = next - _bullet.transform.position; d.y = 0;
+ dis = d.magnitude;
+ dir = d.normalized;
+ }
+
+ }break;
+ }
+
+ if (_data.Skill.Result[_data.Sequnce].LongAttackData.IsPingPong && _pingponged)
+ {
+ Vector3 v = _data.Firer.transform.position - _bullet.transform.position; v.y = 0;
+
+ if (dis >= Vector3.Magnitude(v))
+ {
+ dis = Vector3.Magnitude(v);
+ _active = false;
+ }
+
+ dir = XCommon.singleton.Horizontal(v);
+ }
+ else
+ {
+ if (_data.Target != null && _data.Skill.Result[_data.Sequnce].LongAttackData.Follow)
+ {
+ dir = XCommon.singleton.Horizontal(_data.Target.transform.position - _bullet.transform.position);
+ }
+ }
+
+ if (_data.Skill.Result[_data.Sequnce].LongAttackData.Type != XResultBulletType.Satellite) _bullet.transform.rotation = XCommon.singleton.VectorToQuaternion(dir);
+ Vector3 move = dir * dis;
+ _origin.Set(_bullet.transform.position.x, _bullet.transform.position.y, _bullet.transform.position.z);
+
+ if (_active)
+ {
+ _bullet.transform.position += move;
+
+ if (_data.Skill.Result[_data.Sequnce].LongAttackData.Manipulation)
+ {
+ XSkillHit[] hits = GameObject.FindObjectsOfType<XSkillHit>();
+
+ Vector3 center = _bullet.transform.position;
+
+ foreach (XSkillHit hit in hits)
+ {
+ Vector3 gap = center - hit.transform.position; gap.y = 0;
+
+ if (gap.magnitude < _data.Skill.Result[_data.Sequnce].LongAttackData.ManipulationRadius)
+ {
+ float len = _data.Skill.Result[_data.Sequnce].LongAttackData.ManipulationForce * fDeltaT;
+ hit.transform.Translate(gap.normalized * Mathf.Min(dis, len), Space.World);
+ }
+ }
+ }
+ }
+
+ if (_data.Skill.Result[_data.Sequnce].LongAttackData.WithCollision)
+ {
+ switch (_data.Skill.Result[_data.Sequnce].LongAttackData.Type)
+ {
+ case XResultBulletType.Ring:
+ {
+ float t = XCommon.singleton.IsGreater(_elapsed, _data.Life) ? 0 : (_data.Skill.Result[_data.Sequnce].LongAttackData.RingFull ? (XCommon.singleton.IsGreater(_elapsed, _data.Life * 0.5f) ? (_data.Life - _elapsed) : _elapsed) : _elapsed);
+ float ir = t * _data.Skill.Result[_data.Sequnce].LongAttackData.RingVelocity;
+ float or = ir + _data.Skill.Result[_data.Sequnce].LongAttackData.RingRadius;
+
+ _data.Firer.ir = ir;
+ _data.Firer.or = or;
+
+ RingCollideUnit(ir, or, _data.Firer.transform.position, this);
+ }break;
+ case XResultBulletType.Sphere:
+ case XResultBulletType.Satellite:
+ {
+ Vector3 project = new Vector3(move.x, 0, move.z);
+ float hlen = project.magnitude * 0.5f;
+
+ dir.y = 0;
+
+ float rotation = (dir.sqrMagnitude == 0) ? 0 : Vector3.Angle(Vector3.right, dir);
+ if (rotation > 0 && XCommon.singleton.Clockwise(Vector3.right, dir)) rotation = -rotation;
+
+ BulletCollideUnit(
+ new Vector3(_origin.x + dir.x * hlen, 0, _origin.z + dir.z * hlen),
+ hlen,
+ rotation,
+ _data.Radius,
+ this);
+ } break;
+ case XResultBulletType.Plane:
+ {
+ PlaneBulletCollideUnit(_origin, move, _data.Radius, this);
+ } break;
+ }
+ }
+ }
+
+ private static void RingCollideUnit(float ir, float or, Vector3 center, XBullet bullet)
+ {
+ XSkillHit[] ents = GameObject.FindObjectsOfType<XSkillHit>();
+
+ for (int i = 0; i < ents.Length; i++)
+ {
+ bool collided = false;
+
+ Vector3 v = ents[i].transform.position - center; v.y = 0;
+ float dis = v.sqrMagnitude;
+ collided = dis > (ir * ir) && dis < (or * or);
+
+ if (collided) bullet.Result(ents[i]);
+ if (bullet.IsExpired()) break;
+ }
+ }
+
+ private static void BulletCollideUnit(Vector3 rectcenter, float hlen, float rotation, float r, XBullet bullet)
+ {
+ XSkillHit[] ents = GameObject.FindObjectsOfType<XSkillHit>();
+
+ for (int i = 0; i < ents.Length; i++)
+ {
+ bool collided = false;
+
+ Vector3 cycle = ents[i].RadiusCenter; cycle -= rectcenter; cycle.y = 0;
+ cycle = XCommon.singleton.HorizontalRotateVetor3(cycle, rotation, false);
+
+ collided = XCommon.singleton.IsRectCycleCross(hlen, r, cycle, ents[i].Radius) || Vector3.SqrMagnitude(cycle) < r * r;
+
+ if (collided) bullet.Result(ents[i]);
+ if (bullet.IsExpired()) break;
+ }
+ }
+
+ private static void PlaneBulletCollideUnit(Vector3 origin, Vector3 move, float r, XBullet bullet)
+ {
+ Vector3 side = XCommon.singleton.HorizontalRotateVetor3(move, 90);
+ Vector3 left = origin + side * r;
+ Vector3 right = origin - side * r;
+
+ XSkillHit[] ents = GameObject.FindObjectsOfType<XSkillHit>();
+
+ for (int i = 0; i < ents.Length; i++)
+ {
+ bool collided = false;
+
+ Vector3 pos = ents[i].RadiusCenter;
+
+ collided = XCommon.singleton.IsLineSegmentCross(pos, pos - move, left, right);
+
+ if (collided) bullet.Result(ents[i]);
+ if (bullet.IsExpired()) break;
+ }
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XBullet.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XBullet.cs.meta
new file mode 100644
index 00000000..fac02c7b
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XBullet.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: f9cb93fd63d4fd34795eb5647f44fbbe
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletData.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletData.cs
new file mode 100644
index 00000000..d39f48e9
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletData.cs
@@ -0,0 +1,85 @@
+#if UNITY_EDITOR
+using System;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XEditor
+{
+ internal class XBulletData
+ {
+ private XSkillData _data = null;
+ private XSkillHoster _hoster = null;
+
+ private Vector3 _warning_pos = Vector3.zero;
+
+ private int _sequnce = 0;
+ private float _velocity = 0;
+ private bool _warning = false;
+
+ private GameObject _target = null;
+
+ public XBulletData(XSkillHoster firer, XSkillData data, GameObject target, int idx, float diviation, int wid)
+ {
+ _sequnce = idx;
+
+ _data = data;
+ _hoster = firer;
+
+ _warning_pos = Vector3.zero;
+
+ if (data.Result[idx].Attack_All)
+ {
+ _warning_pos = target.transform.position;
+ }
+ else if (data.Result[idx].Warning)
+ {
+ _warning_pos = firer.WarningPosAt[data.Result[idx].Warning_Idx][wid];
+ }
+
+ _warning = _warning_pos.sqrMagnitude > 0;
+
+ float height = XAnimationLibrary.AssociatedAnimations((uint)_hoster.ConfigData.Player).BoundHeight;
+
+ Vector3 begin = _hoster.gameObject.transform.position; begin.y += height * 0.5f;
+ Vector3 dir = _warning ? (_warning_pos - _hoster.gameObject.transform.position) : firer.transform.forward;
+
+ begin += firer.transform.rotation * new Vector3(
+ data.Result[idx].LongAttackData.At_X,
+ data.Result[idx].LongAttackData.At_Y,
+ data.Result[idx].LongAttackData.At_Z
+ );
+
+ dir.y = 0;
+
+ Vector3 flyTo = XCommon.singleton.HorizontalRotateVetor3(dir.normalized, diviation);
+
+ float h = (_data.Result[_sequnce].LongAttackData.AimTargetCenter && firer.Target != null) ? (begin.y - height * 0.5f) : 0;
+ _velocity = Warning ? (WarningPos - begin).magnitude / Runningtime : _data.Result[_sequnce].LongAttackData.Velocity;
+ flyTo = (h == 0 || _velocity == 0) ? flyTo : (h * Vector3.down + _velocity * Runningtime * flyTo).normalized;
+
+ BulletRay = new Ray(begin, flyTo);
+
+ _target = _data.Result[_sequnce].LongAttackData.Follow ? firer.Target : null;
+ }
+
+ public Ray BulletRay;
+
+ public GameObject Target { get { return _target; } }
+
+ public Vector3 WarningPos { get { return _warning_pos; } }
+ public bool Warning { get { return _warning; } }
+
+ public XSkillData Skill { get { return _data; } }
+
+ public XSkillHoster Firer { get { return _hoster; } }
+ public string Prefab { get { return _data.Result[_sequnce].LongAttackData.Prefab; } }
+
+ public int Sequnce { get { return _sequnce; } }
+
+ public float Velocity { get { return _velocity; } }
+ public float Life { get { return _data.Result[_sequnce].LongAttackData.Runningtime + _data.Result[_sequnce].LongAttackData.Stickytime; } }
+ public float Runningtime { get { return _data.Result[_sequnce].LongAttackData.Runningtime; } }
+ public float Radius { get { return _data.Result[_sequnce].LongAttackData.Radius; } }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletData.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletData.cs.meta
new file mode 100644
index 00000000..2288bfcb
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletData.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 24dbb885a8c4cf34395c5f2d1b6cc28e
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs
new file mode 100644
index 00000000..3053179d
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs
@@ -0,0 +1,34 @@
+#if UNITY_EDITOR
+using System;
+using System.Collections.Generic;
+using XUtliPoolLib;
+
+namespace XEditor
+{
+ internal class XBulletMgr : XSingleton<XBulletMgr>
+ {
+ private List<XBullet> _bullets = new List<XBullet>();
+
+ public void ShootBullet(XBullet bullet)
+ {
+ _bullets.Add(bullet);
+ }
+
+ public void Update(float fDeltaT)
+ {
+ int len = _bullets.Count;
+
+ for (int i = len - 1; i >= 0; i--)
+ {
+ if(_bullets[i].IsExpired())
+ {
+ _bullets[i].Destroy();
+ _bullets.RemoveAt(i);
+ }
+ else
+ _bullets[i].Update(fDeltaT);
+ }
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs.meta
new file mode 100644
index 00000000..f6baad93
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3f5a1fb204f5d3a4cb1a4d00f336b938
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XCameraShake.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XCameraShake.cs
new file mode 100644
index 00000000..f05296c5
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XCameraShake.cs
@@ -0,0 +1,157 @@
+#if UNITY_EDITOR
+using System;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XEditor
+{
+ public class XCameraShake
+ {
+ private GameObject _gameObject = null;
+ private Camera _camera = null;
+
+ private float _timeEscaped = 0;
+ private float _timeInterval = 0;
+ private bool _shake = false;
+
+ private Vector3 x = Vector3.zero;
+ private Vector3 y = Vector3.zero;
+ private Vector3 z = Vector3.zero;
+
+ private float _time = 0;
+ private float _fovAmp = 0;
+ private float _amplitude_x = 0;
+ private float _amplitude_y = 0;
+ private float _amplitude_z = 0;
+ private float _frequency = 0;
+ private CameraMotionSpace _coordinate = CameraMotionSpace.World;
+ private bool _shakeX = true;
+ private bool _shakeY = true;
+ private bool _shakeZ = true;
+
+ private bool _random = false;
+ private float _fov = 0;
+
+ private int _rfactor = 1;
+
+ public XCameraShake(GameObject go, Camera camera)
+ {
+ _camera = camera;
+ _gameObject = go;
+ }
+
+ public bool OnShake(
+ float time,
+ float fovAmp,
+ float amplitude_x,
+ float amplitude_y,
+ float amplitude_z,
+ float frequency,
+ CameraMotionSpace coordinate,
+ bool shakeX,
+ bool shakeY,
+ bool shakeZ,
+ bool random)
+ {
+ _time = time;
+
+ _fovAmp = fovAmp;
+ _amplitude_x = amplitude_x;
+ _amplitude_y = amplitude_y;
+ _amplitude_z = amplitude_z;
+ _frequency = frequency;
+ _coordinate = coordinate;
+ _shakeX = shakeX;
+ _shakeY = shakeY;
+ _shakeZ = shakeZ;
+
+ _random = random;
+
+ _fov = _camera.fieldOfView;
+
+ if (null != _camera)
+ {
+ _timeEscaped = 0;
+ _timeInterval = 0;
+
+ _shake = true;
+
+ switch (_coordinate)
+ {
+ case CameraMotionSpace.Camera:
+ {
+ x = _camera.transform.right;
+ y = _camera.transform.up;
+ z = _camera.transform.forward;
+ } break;
+ case CameraMotionSpace.Self:
+ {
+ x = _gameObject.transform.right;
+ y = _gameObject.transform.up;
+ z = _gameObject.transform.forward;
+ } break;
+ case CameraMotionSpace.World:
+ {
+ x = Vector3.right;
+ y = Vector3.up;
+ z = Vector3.forward;
+ } break;
+ }
+ }
+
+ _rfactor = 1;
+ return true;
+ }
+
+ public void Update(float fDeltaT)
+ {
+ if (null != _camera && _shake)
+ {
+ _timeEscaped += fDeltaT;
+ _timeInterval += fDeltaT;
+
+ if (XCommon.singleton.IsGreater(_timeEscaped, _time))
+ {
+ StopShake();
+ }
+ else
+ {
+ if (XCommon.singleton.IsGreater(_timeInterval, 1 / _frequency))
+ {
+ _rfactor = -_rfactor;
+
+ _camera.transform.position += Shake();
+
+ float fov = UnityEngine.Random.Range(-_fovAmp, _fovAmp);
+ _camera.fieldOfView = _fov + (_random ? fov : _fovAmp * _rfactor);
+
+ _timeInterval = 0;
+ }
+ }
+ }
+ }
+
+ private void StopShake()
+ {
+ _timeEscaped = 0;
+ _shake = false;
+
+ _camera.fieldOfView = _fov;
+ }
+
+ private Vector3 Shake()
+ {
+ float offsetX = _random ? UnityEngine.Random.Range(-_amplitude_x, _amplitude_x) : _amplitude_x * _rfactor;
+ float offsetY = _random ? UnityEngine.Random.Range(-_amplitude_y, _amplitude_y) : _amplitude_y * _rfactor;
+ float offsetZ = _random ? UnityEngine.Random.Range(-_amplitude_z, _amplitude_z) : _amplitude_z * _rfactor;
+
+ Vector3 v = Vector3.zero;
+ if (_shakeX) v += (x * offsetX);
+ if (_shakeY) v += (y * offsetY);
+ if (_shakeZ) v += (z * offsetZ);
+
+ return v;
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XCameraShake.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XCameraShake.cs.meta
new file mode 100644
index 00000000..7497705c
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XCameraShake.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 44c2c35851099364fb63d66fe106386a
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XDataBuilder.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XDataBuilder.cs
new file mode 100644
index 00000000..8f51ed33
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XDataBuilder.cs
@@ -0,0 +1,347 @@
+#if UNITY_EDITOR
+using System;
+using UnityEditor;
+using UnityEditorInternal;
+using UnityEngine;
+using XUtliPoolLib;
+
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Collections.Generic;
+
+namespace XEditor
+{
+ public class XDataBuilder : XSingleton<XDataBuilder>
+ {
+ public static GameObject hoster = null;
+ public static DateTime Time;
+ public static string prefixPath = "";
+
+ public void Load(string pathwithname)
+ {
+ try
+ {
+ XSkillHoster.Quit = false;
+ XConfigData conf = XDataIO<XConfigData>.singleton.DeserializeData(XEditorPath.GetCfgFromSkp(pathwithname));
+ GameObject prefab = XAnimationLibrary.GetDummy((uint)conf.Player);
+
+ if (prefab == null)
+ {
+ Debug.Log("<color=red>Prefab not found by id: " + conf.Player + "</color>");
+ }
+
+ ColdBuild(prefab, conf);
+
+ prefixPath = pathwithname.Substring(0, pathwithname.IndexOf("/SkillPackage"));
+ Time = File.GetLastWriteTime(pathwithname);
+ }
+ catch (Exception e)
+ {
+ Debug.Log("<color=red>Error occurred during loading config file: " + pathwithname + " with error " + e.Message + "</color>");
+ }
+ }
+
+ public void HotBuild(XSkillHoster hoster, XConfigData conf)
+ {
+ hoster.SkillDataExtra.JaEx.Clear();
+ if (conf.Ja != null)
+ {
+ foreach (XJADataExtra ja in conf.Ja)
+ {
+ XJADataExtraEx jaex = new XJADataExtraEx();
+
+ if (ja.Next_Skill_PathWithName != null && ja.Next_Skill_PathWithName.Length > 0)
+ {
+ XSkillData skill = XDataIO<XSkillData>.singleton.DeserializeData("Assets/Resources/" + ja.Next_Skill_PathWithName);
+ jaex.Next = skill;
+ }
+
+ if (ja.JA_Skill_PathWithName != null && ja.JA_Skill_PathWithName.Length > 0)
+ {
+ XSkillData skill = XDataIO<XSkillData>.singleton.DeserializeData("Assets/Resources/" + ja.JA_Skill_PathWithName);
+ jaex.Ja = skill;
+ }
+
+ hoster.SkillDataExtra.JaEx.Add(jaex);
+ }
+ }
+
+ if(hoster.SkillData.TypeToken == 3)
+ {
+ hoster.SkillDataExtra.CombinedEx.Clear();
+ hoster.SkillDataExtra.SkillClip_Frame = 0;
+
+ if (conf.Combined != null)
+ {
+ foreach (XCombinedDataExtra combine in conf.Combined)
+ {
+ XCombinedDataExtraEx combineex = new XCombinedDataExtraEx();
+
+ if (combine.Skill_PathWithName != null && combine.Skill_PathWithName.Length > 0)
+ {
+ XSkillData skill = XDataIO<XSkillData>.singleton.DeserializeData("Assets/Resources/" + combine.Skill_PathWithName);
+ combineex.Skill = skill;
+ combineex.Clip = Resources.Load(skill.ClipName, typeof(AnimationClip)) as AnimationClip;
+
+ hoster.SkillDataExtra.CombinedEx.Add(combineex);
+ hoster.SkillDataExtra.SkillClip_Frame += (combineex.Clip.length / (1.0f / 30.0f));
+ }
+ }
+ }
+ }
+ }
+
+ public void HotBuildEx(XSkillHoster hoster, XConfigData conf)
+ {
+ XSkillDataExtra edata = hoster.SkillDataExtra;
+ XSkillData data = hoster.SkillData;
+
+ edata.ResultEx.Clear();
+ edata.ChargeEx.Clear();
+ edata.Fx.Clear();
+ edata.Audio.Clear();
+ edata.HitEx.Clear();
+ edata.ManipulationEx.Clear();
+
+ if (data.Result != null)
+ {
+ foreach (XResultData result in data.Result)
+ {
+ XResultDataExtraEx rdee = new XResultDataExtraEx();
+ if (result.LongAttackEffect)
+ {
+ rdee.BulletPrefab = Resources.Load(result.LongAttackData.Prefab) as GameObject;
+ rdee.BulletEndFx = Resources.Load(result.LongAttackData.End_Fx) as GameObject;
+ rdee.BulletHitGroundFx = Resources.Load(result.LongAttackData.HitGround_Fx) as GameObject;
+ }
+ edata.ResultEx.Add(rdee);
+ }
+ }
+
+ if (data.Charge != null)
+ {
+ foreach (XChargeData charge in data.Charge)
+ {
+ XChargeDataExtraEx cdee = new XChargeDataExtraEx();
+ cdee.Charge_Curve_Prefab_Forward = Resources.Load(charge.Curve_Forward) as GameObject;
+ cdee.Charge_Curve_Forward = cdee.Charge_Curve_Prefab_Forward == null ? null : cdee.Charge_Curve_Prefab_Forward.GetComponent<XCurve>().Curve;
+
+ cdee.Charge_Curve_Prefab_Side = Resources.Load(charge.Curve_Side) as GameObject;
+ cdee.Charge_Curve_Side = cdee.Charge_Curve_Prefab_Side == null ? null : cdee.Charge_Curve_Prefab_Side.GetComponent<XCurve>().Curve;
+
+ if (charge.Using_Up)
+ {
+ cdee.Charge_Curve_Prefab_Up = Resources.Load(charge.Curve_Up) as GameObject;
+ cdee.Charge_Curve_Up = cdee.Charge_Curve_Prefab_Up == null ? null : cdee.Charge_Curve_Prefab_Up.GetComponent<XCurve>().Curve;
+ }
+
+ edata.ChargeEx.Add(cdee);
+ }
+ }
+
+ if (data.Manipulation != null)
+ {
+ foreach (XManipulationData manipulation in data.Manipulation)
+ {
+ XManipulationDataExtra me = new XManipulationDataExtra();
+
+ edata.ManipulationEx.Add(me);
+ }
+ }
+
+ if (data.Hit != null)
+ {
+ foreach (XHitData hit in data.Hit)
+ {
+ XHitDataExtraEx hee = new XHitDataExtraEx();
+ hee.Fx = Resources.Load(hit.Fx) as GameObject;
+
+ edata.HitEx.Add(hee);
+ }
+ }
+
+ if (data.Fx != null)
+ {
+ foreach (XFxData fx in data.Fx)
+ {
+ XFxDataExtra fxe = new XFxDataExtra();
+ fxe.Fx = Resources.Load(fx.Fx) as GameObject;
+ if (fx.Bone != null && fx.Bone.Length > 0)
+ {
+ Transform attachPoint = hoster.gameObject.transform.Find(fx.Bone);
+ if (attachPoint != null)
+ {
+ fxe.BindTo = attachPoint.gameObject;
+ }
+ else
+ {
+ int index = fx.Bone.LastIndexOf("/");
+ if (index >= 0)
+ {
+ string bone = fx.Bone.Substring(index + 1);
+ attachPoint = hoster.gameObject.transform.Find(bone);
+ if (attachPoint != null)
+ {
+ fxe.BindTo = attachPoint.gameObject;
+ }
+ }
+
+ }
+ }
+
+ fxe.Ratio = fx.At / data.Time;
+
+ edata.Fx.Add(fxe);
+ }
+ }
+
+ if (data.Warning != null)
+ {
+ foreach (XWarningData warning in data.Warning)
+ {
+ XWarningDataExtra we = new XWarningDataExtra();
+ we.Fx = Resources.Load(warning.Fx) as GameObject;
+ we.Ratio = warning.At / data.Time;
+
+ edata.Warning.Add(we);
+ }
+ }
+
+ if (data.Mob != null)
+ {
+ foreach (XMobUnitData mob in data.Mob)
+ {
+ XMobUnitDataExtra me = new XMobUnitDataExtra();
+ me.Ratio = mob.At / data.Time;
+
+ edata.Mob.Add(me);
+ }
+ }
+
+ if (data.Audio != null)
+ {
+ foreach (XAudioData au in data.Audio)
+ {
+ XAudioDataExtra aue = new XAudioDataExtra();
+ aue.audio = Resources.Load(au.Clip) as AudioClip;
+ aue.Ratio = au.At / data.Time;
+
+ edata.Audio.Add(aue);
+ }
+ }
+
+ if (data.CameraMotion != null)
+ {
+ edata.MotionEx = new XCameraMotionDataExtra();
+ edata.MotionEx.Motion3D = Resources.Load(data.CameraMotion.Motion3D, typeof(AnimationClip)) as AnimationClip;
+ edata.MotionEx.Motion2_5D = Resources.Load(data.CameraMotion.Motion2_5D, typeof(AnimationClip)) as AnimationClip;
+ edata.MotionEx.Ratio = data.CameraMotion.At / data.Time;
+ }
+
+ if (data.CameraPostEffect != null)
+ {
+ edata.PostEffectEx = new XCameraPostEffectDataExtraEx();
+ edata.PostEffectEx.Effect = AssetDatabase.LoadAssetAtPath(conf.PostEffect.EffectLocation, typeof(UnityEngine.Object));
+ //edata.PostEffectEx.Shader = Resources.Load(data.CameraPostEffect.Shader, typeof(UnityEngine.Shader)) as UnityEngine.Shader;
+ edata.PostEffectEx.At_Ratio = data.CameraPostEffect.At / data.Time;
+ edata.PostEffectEx.End_Ratio = data.CameraPostEffect.At / data.Time;
+ }
+ }
+
+ public void ColdBuild(GameObject prefab, XConfigData conf)
+ {
+ if (hoster != null) GameObject.DestroyImmediate(hoster);
+
+ hoster = UnityEngine.Object.Instantiate(prefab, Vector3.zero, Quaternion.identity) as GameObject;
+ hoster.transform.localScale = Vector3.one * XAnimationLibrary.AssociatedAnimations((uint)conf.Player).Scale;
+
+ hoster.AddComponent<XSkillHoster>();
+
+ CharacterController cc = hoster.GetComponent<CharacterController>();
+ if (cc != null) cc.enabled = false;
+
+ UnityEngine.AI.NavMeshAgent agent = hoster.GetComponent<UnityEngine.AI.NavMeshAgent>();
+ if (agent != null) agent.enabled = false;
+
+ XSkillHoster component = hoster.GetComponent<XSkillHoster>();
+
+ string directory = conf.Directory[conf.Directory.Length - 1] == '/' ? conf.Directory.Substring(0, conf.Directory.Length - 1) : conf.Directory;
+ string path = XEditorPath.GetPath("SkillPackage" + "/" + directory);
+
+ component.ConfigData = conf;
+ component.SkillData = XDataIO<XSkillData>.singleton.DeserializeData(path + conf.SkillName + ".txt");
+
+ component.SkillDataExtra.ScriptPath = path;
+ component.SkillDataExtra.ScriptFile = conf.SkillName;
+
+ component.SkillDataExtra.SkillClip = RestoreClip(conf.SkillClip, conf.SkillClipName);
+
+ if (component.SkillData.TypeToken != 3)
+ {
+ if (component.SkillData.Time == 0)
+ component.SkillData.Time = component.SkillDataExtra.SkillClip.length;
+ }
+
+ HotBuild(component, conf);
+ HotBuildEx(component, conf);
+
+ EditorGUIUtility.PingObject(hoster);
+ Selection.activeObject = hoster;
+ }
+
+ public void Update(XSkillHoster hoster)
+ {
+ string pathwithname = hoster.SkillDataExtra.ScriptPath + hoster.ConfigData.SkillName + ".txt";
+
+ DateTime time = File.GetLastWriteTime(pathwithname);
+
+ if (Time == default(DateTime)) Time = time;
+
+ if (time != Time)
+ {
+ Time = time;
+
+ if(EditorUtility.DisplayDialog("WARNING!",
+ "Skill has been Modified outside, Press 'OK' to reload file or 'Ignore' to maintain your change. (Make sure the '.config' file for skill script has been well synchronized)",
+ "Ok", "Ignore"))
+ {
+ hoster.ConfigData = XDataIO<XConfigData>.singleton.DeserializeData(XEditorPath.GetCfgFromSkp(pathwithname));
+ hoster.SkillData = XDataIO<XSkillData>.singleton.DeserializeData(pathwithname);
+
+ XDataBuilder.singleton.HotBuild(hoster, hoster.ConfigData);
+ XDataBuilder.singleton.HotBuildEx(hoster, hoster.ConfigData);
+ }
+ }
+ }
+
+ private AnimationClip RestoreClip(string path, string name)
+ {
+ if (path == null || name == null || path == "" || name == "") return null;
+
+ int last = path.LastIndexOf('.');
+ string subfix = path.Substring(last, path.Length - last).ToLower();
+
+ if (subfix == ".fbx")
+ {
+ UnityEngine.Object[] objs = AssetDatabase.LoadAllAssetsAtPath(path);
+ foreach (UnityEngine.Object obj in objs)
+ {
+ AnimationClip clip = obj as AnimationClip;
+ if (clip != null && clip.name == name)
+ return clip;
+ }
+ }
+ else if (subfix == ".anim")
+ {
+ return AssetDatabase.LoadAssetAtPath(path, typeof(AnimationClip)) as AnimationClip;
+
+ }
+ else
+ return null;
+
+ return null;
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XDataBuilder.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XDataBuilder.cs.meta
new file mode 100644
index 00000000..7400f70e
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XDataBuilder.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 4f8b987db0de1b845b2cab2335d6b233
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XDataIO.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XDataIO.cs
new file mode 100644
index 00000000..adb34806
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XDataIO.cs
@@ -0,0 +1,95 @@
+#if UNITY_EDITOR
+using System;
+using UnityEngine;
+using XUtliPoolLib;
+
+using System.IO;
+using System.Text;
+using System.Xml.Serialization;
+using UnityEditor;
+using System.Runtime.Serialization.Formatters.Binary;
+
+namespace XEditor
+{
+ public class XDataIO<T> : XSingleton<XDataIO<T>>
+ {
+ XmlSerializer _formatter = new XmlSerializer(typeof(T));
+
+ public void SerializeData(string pathwithname, T data)
+ {
+ using (FileStream writer = new FileStream(pathwithname, FileMode.Create))
+ {
+ //using Encoding
+ StreamWriter sw = new StreamWriter(writer, Encoding.UTF8);
+ XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();
+ //empty name spaces
+ xsn.Add(string.Empty, string.Empty);
+
+ _formatter.Serialize(sw, data, xsn);
+
+ AssetDatabase.Refresh();
+ }
+ }
+
+ public void SerializeData(string pathwithname, T data, Type[] types)
+ {
+ using (FileStream writer = new FileStream(pathwithname, FileMode.Create))
+ {
+ //using Encoding
+ StreamWriter sw = new StreamWriter(writer, Encoding.UTF8);
+ XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();
+ //empty name spaces
+ xsn.Add(string.Empty, string.Empty);
+
+ XmlSerializer formatter = new XmlSerializer(typeof(T), types);
+ formatter.Serialize(sw, data, xsn);
+
+ AssetDatabase.Refresh();
+ }
+ }
+
+ public T DeserializeData(string pathwithname)
+ {
+ try
+ {
+ using (FileStream reader = new FileStream(pathwithname, FileMode.Open))
+ {
+ //IFormatter formatter = new BinaryFormatter();
+ System.Xml.Serialization.XmlSerializer formatter = new System.Xml.Serialization.XmlSerializer(typeof(T));
+ return (T)formatter.Deserialize(reader);
+ }
+ }
+ catch (Exception e)
+ {
+ Debug.LogError(e.Message);
+ return default(T);
+ }
+ }
+
+ public T DeserializeData(Stream stream)
+ {
+ try
+ {
+ //IFormatter formatter = new BinaryFormatter();
+ System.Xml.Serialization.XmlSerializer formatter = new System.Xml.Serialization.XmlSerializer(typeof(T));
+ return (T)formatter.Deserialize(stream);
+ }
+ catch (Exception e)
+ {
+ Debug.LogError(e.Message);
+ return default(T);
+ }
+ }
+
+ public T DeserializeData(string pathwithname, Type[] types)
+ {
+ using (FileStream reader = new FileStream(pathwithname, FileMode.Open))
+ {
+ //IFormatter formatter = new BinaryFormatter();
+ System.Xml.Serialization.XmlSerializer formatter = new System.Xml.Serialization.XmlSerializer(typeof(T), types);
+ return (T)formatter.Deserialize(reader);
+ }
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XDataIO.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XDataIO.cs.meta
new file mode 100644
index 00000000..1dae6847
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XDataIO.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d3b1fdc81b2846d4fa6534bde4ec0b9b
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XEditorData.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XEditorData.cs
new file mode 100644
index 00000000..760e1335
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XEditorData.cs
@@ -0,0 +1,695 @@
+#if UNITY_EDITOR
+using System;
+using System.Collections.Generic;
+using System.Text;
+using UnityEngine;
+
+using XUtliPoolLib;
+
+using System.IO;
+using UnityEditor;
+
+namespace XEditor
+{
+ public class XParse
+ {
+ private static bool inited = false;
+ public static float Parse(string str)
+ {
+ if(!inited)
+ {
+ System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
+ inited = true;
+ }
+ float value = 0.0f;
+ float.TryParse(str, out value);
+ return value;
+ }
+ }
+ public class XGloabelConfLibrary
+ {
+ private static GlobalTable _table = new GlobalTable();
+
+ public static float Hit_PresentStraight;
+ public static float Hit_HardStraight;
+ public static float Hit_Offset;
+ public static float Hit_Height;
+
+ static string GetValue(string key)
+ {
+ string ret = "";
+ uint k = XCommon.singleton.XHash(key);
+ if (_table.Table.TryGetValue(k, out ret))
+ {
+ return ret;
+ }
+
+ return ret;
+ }
+ static XGloabelConfLibrary()
+ {
+ XTableReader.ReadFile(@"Table/GlobalConfig", _table);
+
+ Hit_PresentStraight = XParse.Parse(GetValue("PresentStraight"));
+ Hit_HardStraight = XParse.Parse(GetValue("HardStraight"));
+ Hit_Offset = XParse.Parse(GetValue("Offset"));
+ Hit_Height = XParse.Parse(GetValue("Height"));
+ }
+ }
+
+ public class XQTEStatusLibrary
+ {
+ private static XQTEStatusTable _table = new XQTEStatusTable();
+ public static List<string> NameList = null;
+ public static List<string> KeyList = null;
+
+ static XQTEStatusLibrary()
+ {
+ XTableReader.ReadFile(@"Table/QteStatusList", _table);
+
+ NameList = new List<string>();
+ KeyList = new List<string>();
+
+ for (int i = 0; i < _table.Table.Length; ++i)
+ {
+ XQTEStatusTable.RowData row = _table.Table[i];
+ NameList.Add(row.Value + " " + row.Name);
+ }
+
+ for (int i = 0; i < (int)KKSG.XSkillSlot.Attack_Max; i++)
+ KeyList.Add(((KKSG.XSkillSlot)i).ToString());
+ }
+
+ public static int GetStatusValue(int idx)
+ {
+ if (idx < 0 || idx >= NameList.Count) return 0;
+
+ string[] strs = NameList.ToArray();
+
+ for (int i = 0; i < _table.Table.Length; ++i)
+ {
+ XQTEStatusTable.RowData row = _table.Table[i];
+ if ((row.Value + " " + row.Name) == strs[idx])
+ return (int)row.Value;
+ }
+
+ return 0;
+ }
+
+ public static int GetStatusIdx(int qte)
+ {
+ string[] strs = NameList.ToArray();
+
+ string str = null;
+ for (int i = 0; i < _table.Table.Length; ++i)
+ {
+ XQTEStatusTable.RowData row = _table.Table[i];
+ if (row.Value == qte)
+ {
+ str = (row.Value + " " + row.Name);
+ break;
+ }
+ }
+
+ if (str != null)
+ {
+ for (int i = 0; i < strs.Length; i++)
+ {
+ if (strs[i] == str) return i;
+ }
+ }
+
+ return 0;
+ }
+ }
+
+ public class XSkillListLibrary
+ {
+ private static SkillList _skilllist = new SkillList();
+
+ static XSkillListLibrary()
+ {
+ XTableReader.ReadFile(@"Table/SkillList", _skilllist);
+ }
+
+ public static SkillList.RowData[] AllList()
+ {
+ return _skilllist.Table;
+ }
+ }
+
+ public class XAnimationLibrary
+ {
+ private static XEntityPresentation _presentations = new XEntityPresentation();
+
+ static XAnimationLibrary()
+ {
+ XTableReader.ReadFile(@"Table/XEntityPresentation", _presentations);
+ }
+
+ public static XEntityPresentation.RowData AssociatedAnimations(uint presentid)
+ {
+ return _presentations.GetByPresentID(presentid);
+ }
+
+ public static GameObject GetDummy(uint presentid)
+ {
+ XEntityPresentation.RowData raw_data = AssociatedAnimations(presentid);
+ if (raw_data == null) return null;
+
+ string prefab = raw_data.Prefab;
+
+ int n = prefab.LastIndexOf("_SkinnedMesh");
+ int m = prefab.LastIndexOf("Loading");
+
+ return n < 0 || m > 0?
+ AssetDatabase.LoadAssetAtPath("Assets/Resources/Prefabs/" + prefab + ".prefab", typeof(GameObject)) as GameObject :
+ AssetDatabase.LoadAssetAtPath("Assets/Editor/EditorResources/Prefabs/" + prefab.Substring(0, n) + ".prefab", typeof(GameObject)) as GameObject;
+ }
+ }
+
+ public class XStatisticsLibrary
+ {
+ private static XEntityStatistics _statistics = new XEntityStatistics();
+
+ static XStatisticsLibrary()
+ {
+ XTableReader.ReadFile(@"Table/XEntityStatistics", _statistics);
+ }
+
+ public static XEntityStatistics.RowData AssociatedData(uint id)
+ {
+ return _statistics.GetByID(id);
+ }
+
+ public static GameObject GetDummy(uint id)
+ {
+ XEntityStatistics.RowData data = AssociatedData(id);
+ if (data == null) return null;
+ return XAnimationLibrary.GetDummy(data.PresentID);
+ }
+ }
+
+ public class XSceneLibrary
+ {
+ private static SceneTable _table = new SceneTable();
+
+ static XSceneLibrary()
+ {
+ XTableReader.ReadFile(@"Table/SceneList", _table);
+ }
+
+ public static SceneTable.RowData AssociatedData(uint id)
+ {
+ return _table.GetBySceneID((int)id);
+ }
+
+ public static string GetDynamicString(string levelConfig)
+ {
+ for (int i = 0; i < _table.Table.Length; i++)
+ {
+ if (_table.Table[i].configFile == levelConfig)
+ return _table.Table[i].DynamicScene;
+ }
+
+ return "";
+ }
+ }
+
+ //public class XEquipBoneLibrary
+ //{
+ // private static EquipBones _statistics = new EquipBones();
+
+ // static XEquipBoneLibrary()
+ // {
+ // //XResourceLoaderMgr.singleton.ReadFile(@"Table/EquipBones", _statistics);
+ // }
+
+ // public static void Read()
+ // {
+ // XResourceLoaderMgr.singleton.ReadFile(@"Table/EquipBones", _statistics);
+ // }
+
+ // public static EquipBones.RowData AssociatedData(string EquipName)
+ // {
+ // return _statistics.GetByEquipName(EquipName);
+ // }
+
+ // public static void ChangeData(string EquipName, EquipBones.RowData data)
+ // {
+ // for (int i = 0; i < _statistics.Table.Count; i++)
+ // {
+ // if (_statistics.Table[i].EquipName == EquipName)
+ // {
+ // _statistics.Table[i] = data;
+ // return;
+ // }
+ // }
+
+ // _statistics.Table.Add(data);
+ // }
+
+ // public static void WriteToFile()
+ // {
+ // string path = "./Assets/Resources/Table/EquipBones.txt";
+
+ // using (FileStream writer = new FileStream(path, FileMode.Truncate))
+ // {
+ // StreamWriter sw = new StreamWriter(writer, Encoding.Unicode);
+
+ // _statistics.Comment = new List<string>();
+ // _statistics.Comment.Add("comment_EquipName");
+ // _statistics.Comment.Add("comment_bones");
+
+ // _statistics.WriteFile(sw);
+
+ // sw.Flush();
+ // sw.Close();
+ // }
+ // }
+ //}
+
+ [Serializable]
+ public class XConfigData
+ {
+ [SerializeField]
+ public string SkillName;
+ [SerializeField]
+ public float Speed = 2.0f;
+ [SerializeField]
+ public float RotateSpeed = 12.0f;
+
+ [SerializeField]
+ public string SkillClip;
+ [SerializeField]
+ public string SkillClipName;
+
+ [SerializeField]
+ public string Directory = null;
+ [SerializeField]
+ public int Player = 0;
+ [SerializeField]
+ public int Dummy = 0;
+
+ [SerializeField]
+ public List<XResultDataExtra> Result = new List<XResultDataExtra>();
+ [SerializeField]
+ public List<XChargeDataExtra> Charge = new List<XChargeDataExtra>();
+ [SerializeField]
+ public List<XJADataExtra> Ja = new List<XJADataExtra>();
+ [SerializeField]
+ public List<XCombinedDataExtra> Combined = new List<XCombinedDataExtra>();
+ [SerializeField]
+ public List<XCameraEffectDataExtra> CameraEffect = new List<XCameraEffectDataExtra>();
+ [SerializeField]
+ public XLogicalDataExtra Logical = new XLogicalDataExtra();
+ [SerializeField]
+ public XUltraDataExtra Ultra = new XUltraDataExtra();
+ [SerializeField]
+ public XCameraPostEffectDataExtra PostEffect = new XCameraPostEffectDataExtra();
+
+ public void Add<T>(T data) where T : XBaseDataExtra
+ {
+ Type t = typeof(T);
+
+ if (t == typeof(XResultDataExtra)) Result.Add(data as XResultDataExtra);
+ else if (t == typeof(XChargeDataExtra)) Charge.Add(data as XChargeDataExtra);
+ else if (t == typeof(XJADataExtra)) Ja.Add(data as XJADataExtra);
+ else if (t == typeof(XCombinedDataExtra)) Combined.Add(data as XCombinedDataExtra);
+ else if (t == typeof(XCameraEffectDataExtra)) CameraEffect.Add(data as XCameraEffectDataExtra);
+ }
+ }
+
+ [Serializable]
+ public class XEditorData
+ {
+ //for serialized
+ [SerializeField]
+ public bool XResult_foldout;
+ [SerializeField]
+ public bool XCharge_foldout;
+ [SerializeField]
+ public bool XHit_foldout;
+ [SerializeField]
+ public bool XJA_foldout;
+ [SerializeField]
+ public bool XScript_foldout;
+ [SerializeField]
+ public bool XMob_foldout;
+ [SerializeField]
+ public bool XCastChain_foldout;
+ [SerializeField]
+ public bool XManipulation_foldout;
+ [SerializeField]
+ public bool XLogical_foldout;
+ [SerializeField]
+ public bool XCombined_foldout;
+ [SerializeField]
+ public bool XUltra_foldout;
+ [SerializeField]
+ public bool XFx_foldout;
+ [SerializeField]
+ public bool XAudio_foldout;
+ [SerializeField]
+ public bool XCameraEffect_foldout;
+ [SerializeField]
+ public bool XCameraMotion_foldout;
+ [SerializeField]
+ public bool XCameraPostEffect_foldout;
+ [SerializeField]
+ public bool XEffect_foldout;
+ [SerializeField]
+ public bool XHitDummy_foldout;
+ [SerializeField]
+ public bool XQTEStatus_foldout;
+ [SerializeField]
+ public bool XWarning_foldout;
+ [SerializeField]
+ public bool XComboSkills_foldout;
+
+ [SerializeField]
+ public bool XAutoSelected;
+ [SerializeField]
+ public bool XFrameByFrame;
+ [SerializeField]
+ public bool XAutoJA = false;
+
+ public void ToggleFold<T>(bool b) where T : XBaseData
+ {
+ Type t = typeof(T);
+
+ if (t == typeof(XResultData)) XResult_foldout = b;
+ else if (t == typeof(XChargeData)) XCharge_foldout = b;
+ else if (t == typeof(XJAData)) XJA_foldout = b;
+ else if (t == typeof(XHitData)) XHit_foldout = b;
+ else if (t == typeof(XScriptData)) XScript_foldout = b;
+ else if (t == typeof(XLogicalData)) XLogical_foldout = b;
+ else if (t == typeof(XFxData)) XFx_foldout = b;
+ else if (t == typeof(XAudioData)) XAudio_foldout = b;
+ else if (t == typeof(XCameraEffectData)) XCameraEffect_foldout = b;
+ else if (t == typeof(XWarningData)) XWarning_foldout = b;
+ }
+ }
+
+ [Serializable]
+ public class XSkillDataExtra
+ {
+ [SerializeField]
+ public AnimationClip SkillClip;
+ [SerializeField]
+ public float SkillClip_Frame;
+ [SerializeField]
+ public string ScriptPath;
+ [SerializeField]
+ public string ScriptFile;
+ [SerializeField]
+ public GameObject Dummy;
+
+ [SerializeField]
+ public List<XResultDataExtraEx> ResultEx = new List<XResultDataExtraEx>();
+ [SerializeField]
+ public List<XChargeDataExtraEx> ChargeEx = new List<XChargeDataExtraEx>();
+ [SerializeField]
+ public List<XFxDataExtra> Fx = new List<XFxDataExtra>();
+ [SerializeField]
+ public List<XManipulationDataExtra> ManipulationEx = new List<XManipulationDataExtra>();
+ [SerializeField]
+ public List<XWarningDataExtra> Warning = new List<XWarningDataExtra>();
+ [SerializeField]
+ public List<XAudioDataExtra> Audio = new List<XAudioDataExtra>();
+ [SerializeField]
+ public List<XMobUnitDataExtra> Mob = new List<XMobUnitDataExtra>();
+ [SerializeField]
+ public XCameraMotionDataExtra MotionEx = new XCameraMotionDataExtra();
+ [SerializeField]
+ public XChainCastExtra Chain = new XChainCastExtra();
+ [SerializeField]
+ public XCameraPostEffectDataExtraEx PostEffectEx = new XCameraPostEffectDataExtraEx();
+ [SerializeField]
+ public List<XJADataExtraEx> JaEx = new List<XJADataExtraEx>();
+ [SerializeField]
+ public List<XHitDataExtraEx> HitEx = new List<XHitDataExtraEx>();
+ [SerializeField]
+ public List<XCombinedDataExtraEx> CombinedEx = new List<XCombinedDataExtraEx>();
+
+ public void Add<T>(T data) where T : XBaseDataExtra
+ {
+ Type t = typeof(T);
+
+ if (t == typeof(XFxDataExtra)) Fx.Add(data as XFxDataExtra);
+ else if (t == typeof(XWarningDataExtra)) Warning.Add(data as XWarningDataExtra);
+ else if (t == typeof(XMobUnitDataExtra)) Mob.Add(data as XMobUnitDataExtra);
+ else if (t == typeof(XAudioDataExtra)) Audio.Add(data as XAudioDataExtra);
+ else if (t == typeof(XJADataExtraEx)) JaEx.Add(data as XJADataExtraEx);
+ else if (t == typeof(XManipulationDataExtra)) ManipulationEx.Add(data as XManipulationDataExtra);
+ else if (t == typeof(XHitDataExtraEx)) HitEx.Add(data as XHitDataExtraEx);
+ else if (t == typeof(XResultDataExtraEx)) ResultEx.Add(data as XResultDataExtraEx);
+ else if (t == typeof(XChargeDataExtraEx)) ChargeEx.Add(data as XChargeDataExtraEx);
+ else if (t == typeof(XCombinedDataExtraEx)) CombinedEx.Add(data as XCombinedDataExtraEx);
+ }
+ }
+
+ [Serializable]
+ public class XBaseDataExtra { }
+
+ [Serializable]
+ public class XResultDataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public float Result_Ratio = 0;
+ }
+
+ [Serializable]
+ public class XChargeDataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public float Charge_Ratio = 0;
+ [SerializeField]
+ public float Charge_End_Ratio = 0;
+ }
+
+ [Serializable]
+ public class XChargeDataExtraEx : XBaseDataExtra
+ {
+ [SerializeField]
+ public GameObject Charge_Curve_Prefab_Forward = null;
+ [SerializeField]
+ public AnimationCurve Charge_Curve_Forward = null;
+ [SerializeField]
+ public GameObject Charge_Curve_Prefab_Side = null;
+ [SerializeField]
+ public AnimationCurve Charge_Curve_Side = null;
+ [SerializeField]
+ public GameObject Charge_Curve_Prefab_Up = null;
+ [SerializeField]
+ public AnimationCurve Charge_Curve_Up = null;
+ }
+
+ [Serializable]
+ public class XUltraDataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public string ultra_end_Skill_PathWithName = null;
+ }
+
+ [Serializable]
+ public class XResultDataExtraEx : XBaseDataExtra
+ {
+ [SerializeField]
+ public GameObject BulletPrefab = null;
+ [SerializeField]
+ public GameObject BulletEndFx = null;
+ [SerializeField]
+ public GameObject BulletHitGroundFx = null;
+ }
+
+ [Serializable]
+ public class XJADataExtraEx : XBaseDataExtra
+ {
+ [SerializeField]
+ public XSkillData Next = null;
+ [SerializeField]
+ public XSkillData Ja = null;
+ }
+
+ [Serializable]
+ public class XCombinedDataExtraEx : XBaseDataExtra
+ {
+ [SerializeField]
+ public XSkillData Skill = null;
+ [SerializeField]
+ public AnimationClip Clip = null;
+ }
+
+ [Serializable]
+ public class XCameraEffectDataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public float Ratio = 0;
+ }
+
+ [Serializable]
+ public class XJADataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public float JA_Begin_Ratio = 0;
+ [SerializeField]
+ public float JA_End_Ratio = 0;
+ [SerializeField]
+ public float JA_Point_Ratio = 0;
+ [SerializeField]
+ public string JA_Skill_PathWithName = null;
+ [SerializeField]
+ public string Next_Skill_PathWithName = null;
+ }
+
+ [Serializable]
+ public class XCombinedDataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public float From_Ratio = 0;
+ [SerializeField]
+ public float To_Ratio = 0;
+ [SerializeField]
+ public string Skill_PathWithName = null;
+ }
+
+ [Serializable]
+ public class XCameraMotionDataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public AnimationClip Motion3D = null;
+ [SerializeField]
+ public AnimationClip Motion2_5D = null;
+ [SerializeField]
+ public float Ratio = 0;
+ }
+
+ [Serializable]
+ public class XCameraPostEffectDataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public string EffectLocation = null;
+ }
+
+ [Serializable]
+ public class XMobUnitDataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public float Ratio = 0;
+ }
+
+ [Serializable]
+ public class XChainCastExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public float Ratio = 0;
+ }
+
+ [Serializable]
+ public class XCameraPostEffectDataExtraEx : XBaseDataExtra
+ {
+ [SerializeField]
+ public UnityEngine.Object Effect = null;
+ [SerializeField]
+ public UnityEngine.Shader Shader = null;
+ [SerializeField]
+ public float At_Ratio = 0;
+ [SerializeField]
+ public float End_Ratio = 0;
+ [SerializeField]
+ public float Solid_At_Ratio = 0;
+ [SerializeField]
+ public float Solid_End_Ratio = 0;
+ }
+
+ [Serializable]
+ public class XQTEDataExtra
+ {
+ [SerializeField]
+ public float QTE_At_Ratio = 0;
+ [SerializeField]
+ public float QTE_End_Ratio = 0;
+ }
+
+ [Serializable]
+ public class XLogicalDataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public float Not_Move_At_Ratio = 0;
+ [SerializeField]
+ public float Not_Move_End_Ratio = 0;
+ [SerializeField]
+ public float Not_Dash_At_Ratio = 0;
+ [SerializeField]
+ public float Not_Dash_End_Ratio = 0;
+ [SerializeField]
+ public float Rotate_At_Ratio = 0;
+ [SerializeField]
+ public float Rotate_End_Ratio = 0;
+ [SerializeField]
+ public List<XQTEDataExtra> QTEDataEx = new List<XQTEDataExtra>();
+ [SerializeField]
+ public float Cancel_At_Ratio = 0;
+ [SerializeField]
+ public float Preserved_Ratio = 0;
+ [SerializeField]
+ public float Preserved_End_Ratio = 0;
+ [SerializeField]
+ public float ExString_Ratio = 0;
+ [SerializeField]
+ public float Not_Selected_At_Ratio = 0;
+ [SerializeField]
+ public float Not_Selected_End_Ratio = 0;
+ }
+
+ [Serializable]
+ public class XFxDataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public GameObject Fx = null;
+ [SerializeField]
+ public GameObject BindTo = null;
+ [SerializeField]
+ public float Ratio = 0;
+ [SerializeField]
+ public float End_Ratio = -1;
+ }
+
+ [Serializable]
+ public class XManipulationDataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public float At_Ratio = 0;
+ [SerializeField]
+ public float End_Ratio = 0;
+ [SerializeField]
+ public bool Present = true;
+ }
+
+ [Serializable]
+ public class XWarningDataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public GameObject Fx = null;
+ [SerializeField]
+ public float Ratio = 0;
+ }
+
+ [Serializable]
+ public class XAudioDataExtra : XBaseDataExtra
+ {
+ [SerializeField]
+ public AudioClip audio = null;
+ [SerializeField]
+ public float Ratio = 0;
+ }
+
+ [Serializable]
+ public class XHitDataExtraEx : XBaseDataExtra
+ {
+ [SerializeField]
+ public GameObject Fx = null;
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XEditorData.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XEditorData.cs.meta
new file mode 100644
index 00000000..1aeef38e
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XEditorData.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 6f74b6399b1b40b4f8d3ae179db757a9
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XEditorPath.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XEditorPath.cs
new file mode 100644
index 00000000..6e85d8d6
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XEditorPath.cs
@@ -0,0 +1,85 @@
+#if UNITY_EDITOR
+using System;
+using UnityEditor;
+
+namespace XEditor
+{
+ public class XEditorPath
+ {
+ public static readonly string Sce = "Assets/XScene/";
+ public static readonly string Cts = "Assets/Resources/CutScene/";
+ public static readonly string Skp = "Assets/Resources/SkillPackage/";
+ public static readonly string Crv = "Assets/Editor/EditorResources/Curve/";
+ public static readonly string Cfg = "Assets/Editor/EditorResources/SkillPackage/";
+ public static readonly string Scb = "Assets/Resources/Table/SceneBlock/";
+ public static readonly string Lev = "Assets/Resources/Table/Level/";
+
+ private static readonly string _root = "Assets/Resources";
+ private static readonly string _editor_root = "Assets/Editor";
+ private static readonly string _editor_res_root = "Assets/Editor/EditorResources";
+
+ public static string GetCfgFromSkp(string skp, string suffix = ".config")
+ {
+ skp = skp.Replace("/Resources/", "/Editor/EditorResources/");
+ int m = skp.LastIndexOf('.');
+
+ return skp.Substring(0, m) + suffix;
+ }
+
+ private static void RootPath()
+ {
+ if (!System.IO.Directory.Exists(_root))
+ {
+ AssetDatabase.CreateFolder("Assets", "Resources");
+ }
+ }
+
+ private static void EditorRootPath()
+ {
+ if (!System.IO.Directory.Exists(_editor_root))
+ {
+ AssetDatabase.CreateFolder("Assets", "Editor");
+ }
+
+ if (!System.IO.Directory.Exists(_editor_res_root))
+ {
+ AssetDatabase.CreateFolder("Assets/Editor", "EditorResources");
+ }
+ }
+
+ public static string BuildPath(string dictionary, string root)
+ {
+ string[] splits = dictionary.Split('/');
+ string _base = root;
+
+ foreach (string s in splits)
+ {
+ string path = _base + "/" + s + "/";
+
+ if (!System.IO.Directory.Exists(path))
+ {
+ AssetDatabase.CreateFolder(_base, s);
+ }
+
+ _base = path.Substring(0, path.Length - 1);
+ }
+
+ return _base + "/";
+ }
+
+ public static string GetEditorBasedPath(string dictionary)
+ {
+ EditorRootPath();
+
+ return BuildPath(dictionary, _editor_res_root);
+ }
+
+ public static string GetPath(string dictionary)
+ {
+ RootPath();
+
+ return BuildPath(dictionary, _root);
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XEditorPath.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XEditorPath.cs.meta
new file mode 100644
index 00000000..9286e417
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XEditorPath.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3c12cb2816c50a54ba933da363e766ed
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XGesture.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XGesture.cs
new file mode 100644
index 00000000..5c7b1eb1
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XGesture.cs
@@ -0,0 +1,205 @@
+#if UNITY_EDITOR
+using System;
+using System.Collections.Generic;
+using XUtliPoolLib;
+using UnityEngine;
+
+namespace XEditor
+{
+ internal class XGesture : XSingleton<XGesture>
+ {
+ public enum SwypeDirectionType
+ {
+ Left, Right
+ }
+
+ private bool _one = false;
+ private bool _double = false;
+ private bool _bswype = false;
+
+ private float _last_swype_at = 0;
+
+ private float _start_at = 0;
+ //private float _swype_start_at = 0;
+
+ private Vector2 _start = Vector2.zero;
+ private Vector2 _swype_start = Vector2.zero;
+
+ private Vector2 _end = Vector2.zero;
+ private XTouchItem _touch;
+
+ private Vector3 _swypedir = Vector3.zero;
+ private Vector3 _touchpos = Vector3.zero;
+
+ private float _last_touch_at = 0;
+
+ private SwypeDirectionType _swype_type;
+
+ public bool Gestured
+ {
+ get { return _bswype || _one || _double; }
+ }
+
+ public bool OneTouch
+ {
+ get { return _one; }
+ }
+
+ public bool DoubleTouch
+ {
+ get { return _double; }
+ }
+
+ public bool Swype
+ {
+ get { return _bswype; }
+ }
+
+ public float LastSwypeAt
+ {
+ get { return _last_swype_at; }
+ }
+
+ public Vector3 SwypeDirection
+ {
+ get { return -_swypedir; }
+ }
+
+ public SwypeDirectionType SwypeType
+ {
+ get { return _swype_type; }
+ }
+
+ public Vector3 TouchPosition
+ {
+ get { return _touchpos; }
+ }
+
+ public void Update()
+ {
+ XTouch.singleton.Update();
+ _touch = XTouch.singleton.GetTouch();
+
+ if (_touch != null)
+ {
+ if (_touch.Phase == TouchPhase.Began)
+ {
+ _start = _touch.Position;
+ _swype_start = _start;
+
+ _start_at = Time.time;
+ //_swype_start_at = _start_at;
+ }
+
+ _bswype = SwypeUpdate();
+ _one = OneUpdate();
+ _double = DoubleUpdate();
+ }
+ else
+ {
+ Clear();
+ }
+ }
+
+ private void Clear()
+ {
+ _one = false;
+ _double = false;
+ _bswype = false;
+ }
+
+ private bool OneUpdate()
+ {
+ TouchPhase phase = _touch.Phase;
+
+ if ((phase == TouchPhase.Ended ||
+ phase == TouchPhase.Canceled))
+ {
+ Vector2 delta = _touch.Position - _start;
+
+ float dist = Mathf.Sqrt(Mathf.Pow(delta.x, 2) + Mathf.Pow(delta.y, 2));
+ float duration = Time.time - _start_at;
+
+ if (dist < 5 && duration < 0.2f / Time.timeScale)
+ {
+ _last_touch_at = Time.time;
+ _touchpos = _touch.Position;
+
+ return true;
+ }
+ else
+ return false;
+ }
+
+ return false;
+ }
+
+ private bool DoubleUpdate()
+ {
+ if (_touch.Phase == TouchPhase.Began)
+ {
+ float deltaT = Time.time - _last_touch_at;
+ if (XCommon.singleton.IsLess(deltaT, 0.5f / Time.timeScale))
+ {
+ Vector2 delta;
+ delta.x = _start.x - TouchPosition.x;
+ delta.y = _start.y - TouchPosition.y;
+
+ float dist = Mathf.Sqrt(Mathf.Pow(delta.x, 2) + Mathf.Pow(delta.y, 2));
+
+ if (dist < 50.0f)
+ {
+ _touchpos = _touch.Position;
+ _one = false;
+
+ return true;
+ }
+ else
+ return false;
+ }
+ }
+
+ return false;
+ }
+
+ private bool SwypeUpdate()
+ {
+ TouchPhase phase = _touch.Phase;
+
+ if (phase == TouchPhase.Moved)
+ {
+ _end = _touch.Position;
+ Vector2 delta = _end - _swype_start;
+
+ float endAt = Time.time;
+
+ float dist = Mathf.Sqrt(Mathf.Pow(delta.x, 2) + Mathf.Pow(delta.y, 2));
+ //float angle = Mathf.Atan(delta.y / delta.x) * (180.0f / Mathf.PI);
+ //float duration = endAt - _swype_start_at;
+ //float speed = dist / duration;
+
+ if (dist > 50.0f)
+ {
+ _swype_type = XCommon.singleton.IsGreater(_swype_start.x, Screen.width * 0.5f) ? XGesture.SwypeDirectionType.Right : XGesture.SwypeDirectionType.Left;
+
+ _swype_start = _end;
+ //_swype_start_at = Time.time;
+
+ _swypedir.x = delta.x;
+ _swypedir.y = 0;
+ _swypedir.z = delta.y;
+
+ _swypedir.Normalize();
+ _touchpos = _end;
+
+ _last_swype_at = endAt; // _swype_start_at;
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XGesture.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XGesture.cs.meta
new file mode 100644
index 00000000..aa3272ca
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XGesture.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 1c3f08e53b58ec74e85dc716d4b04732
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XSerialized.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XSerialized.cs
new file mode 100644
index 00000000..6d71a0bc
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XSerialized.cs
@@ -0,0 +1,70 @@
+#if UNITY_EDITOR
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+
+namespace XEditor
+{
+ public class XSerialized<T> where T : class
+ {
+ //deep copy of T
+ private static string SerializeToString(T value)
+ {
+ using (MemoryStream objectStream = new MemoryStream())
+ {
+ IFormatter formatter = new BinaryFormatter();
+ formatter.Serialize(objectStream, value);
+ objectStream.Flush();
+ return Convert.ToBase64String(objectStream.ToArray());
+ }
+ }
+
+ private static T DeserializeFromString(string data)
+ {
+ byte[] bytes = Convert.FromBase64String(data);
+ using (MemoryStream stream = new MemoryStream(bytes))
+ {
+ return (T)(new BinaryFormatter()).Deserialize(stream);
+ }
+ }
+
+ [SerializeField]
+ private string _serializedData;
+
+ protected T _class;
+
+ public XSerialized() { }
+
+ public XSerialized(T _class)
+ {
+ Set(_class);
+ }
+
+ public void Set(T _class)
+ {
+ this._class = _class;
+ Serialize();
+ }
+
+ public T Get()
+ {
+ if (_class == null) _class = Deserialize();
+ return _class;
+ }
+
+ public virtual void Serialize()
+ {
+ _serializedData = SerializeToString(_class);
+ }
+
+ protected virtual T Deserialize()
+ {
+ return DeserializeFromString(_serializedData);
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XSerialized.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XSerialized.cs.meta
new file mode 100644
index 00000000..f4c68d74
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XSerialized.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 91e1ee7b64f910b4f814f69fdd807984
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCamera.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCamera.cs
new file mode 100644
index 00000000..f7a2af18
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCamera.cs
@@ -0,0 +1,389 @@
+#if UNITY_EDITOR
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XEditor
+{
+ public class XSkillCamera
+ {
+ public XSkillCamera(GameObject hoster)
+ {
+ _hoster = hoster;
+ }
+
+ private GameObject _hoster = null;
+ private enum XCameraExStatus
+ {
+ Idle,
+ Dash,
+ Effect,
+ UltraShow,
+ UltraEnd
+ }
+
+ private bool _status_changed = false;
+
+ private XCameraExStatus _status = XCameraExStatus.Idle;
+
+ private GameObject _cameraObject = null;
+
+ private GameObject _dummyObject = null;
+ private Transform _dummyCamera = null;
+ private Transform _cameraTransform = null;
+
+ private Animator _ator = null;
+ public AnimatorOverrideController _overrideController = new AnimatorOverrideController();
+
+ private string _trigger = null;
+
+ private UnityEngine.Camera _camera = null;
+
+ private float _elapsed = 0;
+
+ private bool _damp = false;
+ private float _damp_delta = 0;
+ private Vector3 _damp_dir = Vector3.zero;
+
+ private bool _follow_position = true;
+ private bool _relative_to_idle = false;
+ private bool _look_at = false;
+ private bool _sync_begin = false;
+ private CameraMotionSpace _effect_axis = CameraMotionSpace.World;
+
+ private bool _root_pos_inited = false;
+ private bool _idle_root_pos_inited = false;
+
+ private Vector3 _root_pos = Vector3.zero;
+ private Vector3 _idle_root_pos = Vector3.zero;
+
+ private Vector3 _v_self_p = Vector3.zero;
+ private Quaternion _q_self_r = Quaternion.identity;
+
+ private Quaternion _idle_root_rotation = Quaternion.identity;
+ private float _idle_root_rotation_y = 0;
+
+ private Vector3 _last_dummyCamera_pos = Vector3.zero;
+ private Vector3 _dummyCamera_pos = Vector3.zero;
+
+ private readonly float _damp_factor = 1.0f;
+
+ private XCameraMotionData _motion = new XCameraMotionData();
+
+ //kill all timer when leave scene.
+ private uint _token = 0;
+
+ public UnityEngine.Camera UnityCamera
+ {
+ get { return _camera; }
+ }
+
+ public Transform CameraTrans
+ {
+ get { return _cameraTransform; }
+ }
+
+ public Animator CameraAnimator
+ {
+ get { return _ator; }
+ }
+
+ public Vector3 Position
+ {
+ get { return _cameraTransform.position; }
+ }
+
+ public Quaternion Rotaton
+ {
+ get { return _cameraTransform.rotation; }
+ }
+
+ public bool Initialize()
+ {
+ _cameraObject = GameObject.Find(@"Main Camera");
+
+ if (null != _cameraObject)
+ {
+ _camera = _cameraObject.GetComponent<UnityEngine.Camera>();
+ _cameraTransform = _cameraObject.transform;
+
+ XResourceLoaderMgr.SafeDestroy(ref _dummyObject);
+
+ _dummyObject = XResourceLoaderMgr.singleton.CreateFromPrefab("Prefabs/DummyCamera") as GameObject;
+ _dummyObject.name = "Dummy Camera";
+
+ _dummyCamera = _dummyObject.transform.GetChild(0);
+ _ator = _dummyObject.GetComponent<Animator>();
+
+ _overrideController.runtimeAnimatorController = _ator.runtimeAnimatorController;
+ _ator.runtimeAnimatorController = _overrideController;
+
+ _root_pos_inited = false;
+ _idle_root_pos_inited = false;
+
+ _status = XCameraExStatus.Idle;
+ _status_changed = false;
+
+ _idle_root_rotation_y = 0;
+
+ //_overrideController["Idle"] = Resources.Load("Animation/Main_Camera/Main_Camera_Idle");
+ }
+
+ return true;
+ }
+
+ public void Damp()
+ {
+ _damp = true;
+ _elapsed = 0;
+ }
+
+ public void YRotate(float addation)
+ {
+ if (addation != 0)
+ {
+ _idle_root_rotation_y += addation;
+
+ _idle_root_rotation = Quaternion.Euler(0, _idle_root_rotation_y, 0);
+ _root_pos = _idle_root_rotation * _dummyCamera.position;
+ }
+ }
+
+ public void OverrideAnimClip(string motion, string clipname)
+ {
+ //get override clip
+ AnimationClip animClip = XResourceLoaderMgr.singleton.GetSharedResource<AnimationClip>(clipname, ".anim");
+ OverrideAnimClip(motion, animClip);
+ }
+
+ public void OverrideAnimClip(string motion, AnimationClip clip)
+ {
+ //override
+ if (clip != null && _overrideController[motion] != clip) _overrideController[motion] = clip;
+ }
+
+ public void Effect(XCameraMotionData motion)
+ {
+ Effect(motion, "ToEffect");
+ }
+
+ public void UltraShow()
+ {
+ _trigger = "ToUltraShow";
+
+ _motion.Follow_Position = false;
+ _motion.Coordinate = CameraMotionSpace.Self;
+ _motion.AutoSync_At_Begin = true;
+ _motion.LookAt_Target = false;
+ }
+
+ public void UltraEnd()
+ {
+ _trigger = "ToUltraEnd";
+
+ _motion.Follow_Position = false;
+ _motion.Coordinate = CameraMotionSpace.World;
+ _motion.AutoSync_At_Begin = true;
+ _motion.LookAt_Target = false;
+ }
+
+ public void PostUpdate(float fDeltaT)
+ {
+ if (!_root_pos_inited)
+ {
+ _idle_root_rotation = Quaternion.Euler(0, _idle_root_rotation_y, 0);
+
+ _root_pos = _idle_root_rotation * _dummyCamera.position;
+ _root_pos_inited = true;
+
+ if (!_idle_root_pos_inited)
+ {
+ _idle_root_pos = _idle_root_rotation * _dummyCamera.position;
+ _idle_root_pos_inited = true;
+ }
+ }
+
+ InnerUpdateEx();
+ TriggerEffect();
+ }
+
+ private void AutoSync()
+ {
+ _q_self_r = _hoster.transform.rotation;
+ _v_self_p = _hoster.transform.position;
+ }
+
+ private void InnerPosition()
+ {
+ _dummyCamera_pos = _idle_root_rotation * _dummyCamera.position;
+
+ if (_damp)
+ {
+ _damp_dir = (_dummyCamera_pos - _last_dummyCamera_pos);
+ if (_elapsed == 0) _damp_delta = _damp_dir.magnitude;
+ _damp_dir.Normalize();
+
+ if (_elapsed > _damp_factor)
+ {
+ _elapsed = _damp_factor;
+ _damp = false;
+ }
+
+ _dummyCamera_pos = _dummyCamera_pos - _damp_dir * (_damp_delta * ((_damp_factor - _elapsed) / _damp_factor));
+ }
+
+ _last_dummyCamera_pos = _dummyCamera_pos;
+ }
+
+ private void InnerUpdateEx()
+ {
+ InnerPosition();
+
+ Quaternion q_self_r = _hoster.transform.rotation;
+ Vector3 v_self_p = _hoster.transform.position;
+
+ Vector3 r = _dummyCamera.rotation.eulerAngles; r.y -= 90;
+ float f = r.x; r.x = r.z; r.z = f;
+
+ if (_status_changed || _status == XCameraExStatus.Idle) _status_changed = false;
+
+ Vector3 delta = (_dummyCamera_pos - _root_pos);
+ Vector3 target_pos;
+
+ {
+ target_pos = (_sync_begin ? _q_self_r : Quaternion.identity) * (_relative_to_idle ? _idle_root_pos : _root_pos);
+ delta = (_sync_begin ? _q_self_r : Quaternion.identity) * delta;
+
+ if (!_look_at) _cameraTransform.rotation = _idle_root_rotation * (_sync_begin ? _q_self_r : Quaternion.identity) * Quaternion.Euler(r);
+ }
+
+ target_pos += (_follow_position ? v_self_p : (_sync_begin ? _v_self_p : Vector3.zero));
+
+ switch (_effect_axis)
+ {
+ case CameraMotionSpace.World:
+ {
+ target_pos += delta;
+ } break;
+ case CameraMotionSpace.Self:
+ {
+ target_pos += (_follow_position ? Quaternion.identity : q_self_r) * delta;
+ } break;
+ }
+
+ _cameraTransform.position = target_pos;
+ if (_look_at) _cameraTransform.LookAt(_hoster.transform.position + _dummyObject.transform.position);
+ }
+
+ public void EndEffect(object o)
+ {
+ if (_status == XCameraExStatus.Idle) return;
+
+ _trigger = "ToIdle";
+
+ _motion.Follow_Position = true;
+ _motion.Coordinate = CameraMotionSpace.World;
+ _motion.AutoSync_At_Begin = false;
+ _motion.LookAt_Target = true;
+
+ _motion.Motion = null;
+ }
+
+ public void Effect(XCameraMotionData motion, bool overrideclip)
+ {
+ //must be called from UPDATE pass
+ AnimationClip clip = XResourceLoaderMgr.singleton.GetSharedResource<AnimationClip>(motion.Motion3D, ".anim");
+
+ if (clip != null)
+ {
+ _trigger = "ToEffect";
+ if (overrideclip && _overrideController["CameraEffect"] != clip) _overrideController["CameraEffect"] = clip;
+
+ _motion.LookAt_Target = motion.LookAt_Target;
+ _motion.Follow_Position = true;
+ _motion.Coordinate = CameraMotionSpace.World;
+
+ switch (motion.Motion3DType)
+ {
+ case CameraMotionType.AnchorBased:
+ {
+ _motion.AutoSync_At_Begin = true;
+ _motion.LookAt_Target = false;
+ }break;
+ case CameraMotionType.CameraBased:
+ {
+ _motion.AutoSync_At_Begin = false;
+ }break;
+ }
+
+ _motion.Motion = motion.Motion3D;
+ }
+ }
+
+ public void Effect(XCameraMotionData motion, string trigger)
+ {
+ //must be called from UPDATE pass
+ //AnimationClip clip = Resources.Load(motion.Motion3D);
+
+ //if (clip != null)
+ {
+ _trigger = trigger;
+
+ _motion.LookAt_Target = motion.LookAt_Target;
+ _motion.Follow_Position = true;
+ _motion.Coordinate = CameraMotionSpace.World;
+
+ switch (motion.Motion3DType)
+ {
+ case CameraMotionType.AnchorBased:
+ {
+ _motion.AutoSync_At_Begin = true;
+ _motion.LookAt_Target = false;
+ } break;
+ case CameraMotionType.CameraBased:
+ {
+ _motion.AutoSync_At_Begin = false;
+ } break;
+ }
+
+ _motion.Motion = motion.Motion3D;
+ }
+ }
+
+ private void TriggerEffect()
+ {
+ if (_trigger != null && !_ator.IsInTransition(0))
+ {
+ switch (_trigger)
+ {
+ case "ToIdle":
+ {
+ _status = XCameraExStatus.Idle;
+ _idle_root_pos_inited = false;
+ } break;
+ case "ToEffect": _status = XCameraExStatus.Effect; break;
+ case "ToDash": _status = XCameraExStatus.Dash; break;
+ case "ToUltraShow": _status = XCameraExStatus.UltraShow; break;
+ case "ToUltraEnd": _status = XCameraExStatus.UltraEnd; break;
+ }
+
+ XTimerMgr.singleton.KillTimer(_token);
+
+ _follow_position = _motion.Follow_Position;
+ _effect_axis = _motion.Coordinate;
+ _sync_begin = _motion.AutoSync_At_Begin;
+ _look_at = _motion.LookAt_Target;
+
+ if (_sync_begin) AutoSync();
+
+ _ator.SetTrigger(_trigger);
+ _root_pos_inited = false;
+
+ _status_changed = true;
+ _trigger = null;
+ }
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCamera.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCamera.cs.meta
new file mode 100644
index 00000000..435677ae
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCamera.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 99a4f88638219ec4ba012de9b971a65a
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCharge.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCharge.cs
new file mode 100644
index 00000000..8faa78bc
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCharge.cs
@@ -0,0 +1,200 @@
+#if UNITY_EDITOR
+using System;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XEditor
+{
+ public class XSkillCharge
+ {
+ public XSkillCharge(XSkillHoster host, XCurve curve_forward, XCurve curve_side, XCurve curve_up, bool using_up, float time_offset, bool aim, bool standon, bool control)
+ {
+ if (time_offset >= curve_forward.Curve[curve_forward.Curve.length - 1].time)
+ {
+ _timeElapsed = 0.1f;
+ _span = 0;
+
+ return;
+ }
+
+ _using_curve = true;
+ _using_up = using_up;
+ _aim_target = aim;
+ _stand_on = standon;
+ _control_towards = control;
+
+ _curve_forward = curve_forward.Curve;
+ _curve_side = curve_side.Curve;
+ _curve_up = curve_up == null ? null : curve_up.Curve;
+
+ _xcurve_up = curve_up;
+
+ _host = host;
+
+ _span = _curve_forward[_curve_forward.length - 1].time;
+
+ _distance = 0;
+
+ _last_offset_forward = 0;
+ _last_offset_side = 0;
+ _last_offset_up = 0;
+
+ _timeElapsed = time_offset;
+
+ Prepare();
+ }
+
+ public XSkillCharge(XSkillHoster host, float span, float offset, float height, float time_offset, float rotation, bool aim, bool standon, bool control)
+ {
+ if (time_offset >= span)
+ {
+ _timeElapsed = 0.1f;
+ _span = 0;
+
+ return;
+ }
+
+ _using_curve = false;
+ _control_towards = control;
+ _aim_target = aim;
+ _stand_on = standon;
+
+ _span = span;
+ _height = height;
+
+ _host = host;
+
+ _distance = offset;
+ _timeElapsed = time_offset;
+
+ _rotation_speed = _aim_target ? 0 : rotation;
+
+ Prepare();
+ }
+
+ private XSkillHoster _host = null;
+
+ private XCurve _xcurve_up = null;
+
+ private AnimationCurve _curve_forward = null;
+ private AnimationCurve _curve_side = null;
+ private AnimationCurve _curve_up = null;
+
+ private bool _using_curve = false;
+ private bool _using_up = false;
+ private bool _aim_target = false;
+ private bool _stand_on = true;
+ private bool _control_towards = false;
+
+ private float _scale = 1;
+ private float _last_offset_forward = 0;
+ private float _last_offset_side = 0;
+ private float _last_offset_up = 0;
+
+ private float _distance = 0;
+ private float _height = 0;
+ private float _span = 0;
+ private float _height_drop = 0;
+ private float _land_time = 0;
+
+ private float _timeElapsed = 0;
+ private float _gravity = 0;
+ private float _rticalV = 0;
+
+ private float _step_speed = 0;
+ private float _rotation_speed = 0;
+ private Vector2 _step_dir = Vector2.zero;
+
+ public bool Update(float deltaTime)
+ {
+ if (XCommon.singleton.IsGreater(_timeElapsed, _span))
+ return true;
+
+ float v1 = _rticalV - _gravity * _timeElapsed;
+ _timeElapsed += deltaTime;
+ float v2 = _rticalV - _gravity * _timeElapsed;
+
+ float dis = (_aim_target && _host.Target != null) ? (_host.Target.gameObject.transform.position - _host.gameObject.transform.position).magnitude : Mathf.Infinity;
+ Vector3 forward = (_control_towards && _host.ControlDir.sqrMagnitude > 0) ? _host.ControlDir : ((_aim_target && _host.Target != null) ? XCommon.singleton.Horizontal(_host.Target.gameObject.transform.position - _host.gameObject.transform.position) : _host.gameObject.transform.forward);
+
+ _step_dir.x = forward.x;
+ _step_dir.y = forward.z;
+ _step_dir.Normalize();
+
+ Vector2 delta;
+ float h = 0;
+
+ if (_using_curve)
+ {
+ float offset_forward = _curve_forward.Evaluate(_timeElapsed) * _scale;
+ float delta_offset_forward = offset_forward - _last_offset_forward;
+ _last_offset_forward = offset_forward;
+
+ float offset_side = _curve_side.Evaluate(_timeElapsed) * _scale;
+ float delta_offset_side = offset_side - _last_offset_side;
+ _last_offset_side = offset_side;
+
+ Vector3 right = XCommon.singleton.Horizontal(Vector3.Cross(_host.gameObject.transform.up, _step_dir));
+ delta = delta_offset_forward * _step_dir + delta_offset_side * new Vector2(right.x, right.z);
+
+ if (_using_up)
+ {
+ float offset_up = _curve_up.Evaluate(_timeElapsed) * _scale;
+ h = offset_up - _last_offset_up;
+ _last_offset_up = offset_up;
+ }
+ }
+ else
+ {
+ delta = _step_speed * deltaTime * _step_dir;
+
+ h = (v1 + v2) / 2.0f * deltaTime;
+
+ if (_rotation_speed > 0)
+ {
+ _host.gameObject.transform.forward = XCommon.singleton.HorizontalRotateVetor3(_host.gameObject.transform.forward, _rotation_speed * deltaTime);
+ }
+ }
+
+ h -= _land_time > 0 ? (deltaTime) * (_height_drop / _land_time) : _height_drop;
+
+ if (dis - 0.5f < delta.magnitude) delta.Set(0, 0);
+ _host.gameObject.transform.Translate(delta.x, h, delta.y, Space.World);
+
+ return false;
+ }
+
+ protected void Prepare()
+ {
+ Vector3 dir = _host.GetRotateTo();
+
+ _step_dir.x = dir.x;
+ _step_dir.y = dir.z;
+
+ _step_dir.Normalize();
+
+ _land_time = 0;
+
+ if (_using_curve)
+ {
+ if (_using_up)
+ {
+ _land_time = _xcurve_up.GetLandValue();
+ }
+ }
+ else
+ {
+ _step_speed = _distance / _span;
+
+ _rticalV = (_height * 4.0f) / _span;
+ _gravity = _rticalV / _span * 2.0f;
+ }
+
+ _height_drop = _stand_on ? _host.transform.position.y : 0;
+ if (_height_drop < 0) _height_drop = 0;
+
+ _scale = XAnimationLibrary.AssociatedAnimations((uint)_host.ConfigData.Player).Scale;
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCharge.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCharge.cs.meta
new file mode 100644
index 00000000..d7210f10
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillCharge.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 235dca4a82363e147ae6be42befd528f
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHit.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHit.cs
new file mode 100644
index 00000000..5026eea4
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHit.cs
@@ -0,0 +1,545 @@
+#if UNITY_EDITOR
+using System;
+using UnityEngine;
+using XUtliPoolLib;
+using System.Collections.Generic;
+
+namespace XEditor
+{
+ public class XSkillHit : MonoBehaviour
+ {
+ [SerializeField]
+ public int PresentID = 0;
+
+ private XEntityPresentation.RowData _present_data = null;
+
+ private XHitData _data = null;
+ private AnimatorOverrideController _oVerrideController = null;
+
+ void Start()
+ {
+ _present_data = XAnimationLibrary.AssociatedAnimations((uint)PresentID);
+
+ if (_oVerrideController == null) BuildOverride();
+ _oVerrideController["Idle"] = XResourceLoaderMgr.singleton.GetSharedResource<AnimationClip>("Animation/" + _present_data.AnimLocation + _present_data.AttackIdle, ".anim");
+ _oVerrideController["HitLanding"] = _present_data.HitFly!=null&&_present_data.HitFly.Length == 0 ? null : XResourceLoaderMgr.singleton.GetSharedResource<AnimationClip>("Animation/" + _present_data.AnimLocation + _present_data.HitFly[1], ".anim");
+
+ _radius = _present_data.BoundRadius;
+ _dummy_height = _present_data.BoundHeight;
+ }
+
+ private void BuildOverride()
+ {
+ _oVerrideController = new AnimatorOverrideController();
+
+ _ator = GetComponent<Animator>();
+ _oVerrideController.runtimeAnimatorController = _ator.runtimeAnimatorController;
+ _ator.runtimeAnimatorController = _oVerrideController;
+ }
+
+ private float _radius = 0;
+ private float _dummy_height = 0;
+
+ private string _trigger = null;
+
+ private Vector2 _pos = Vector2.zero;
+ private Vector2 _des = Vector2.zero;
+
+ private Vector3 _dir = Vector3.zero;
+
+ private float _last_offset = 0;
+ private float _last_height = 0;
+
+ private float _delta_x = 0;
+ private float _delta_y = 0;
+ private float _delta_z = 0;
+
+ private float _deltaH = 0;
+
+ private float _gravity = 0;
+ private float _rticalV = 0;
+
+ private float _factor = 0;
+ private float _elapsed = 0;
+
+ private float _time_total = 0;
+
+ //private bool _running = false;
+ private bool _bcurve = false;
+ private bool _loop_hard = true;
+ private bool _change_to_fly = false;
+
+ private float _present_straight = 1;
+ private float _hard_straight = 1;
+ private float _height = 0;
+ private float _offset = 0;
+
+ private float _present_animation_factor = 1;
+
+ private float _present_anim_time = 0;
+ private float _landing_time = 0;
+ private float _hard_straight_time = 0;
+ private float _getup_time = 0;
+
+ private XBeHitPhase _phase = XBeHitPhase.Hit_Present;
+
+ private Animator _ator = null;
+
+ private XSkillHoster _hoster = null;
+
+ private GameObject _hit_fx = null;
+ private Transform _binded_bone = null;
+
+ private IXCurve _curve_h = null;
+ private IXCurve _curve_v = null;
+
+ private float _curve_height_scale = 1;
+ private float _curve_offset_scale = 1;
+ private float _curve_height_time_scale = 1;
+ private float _curve_offset_time_scale = 1;
+
+ public Animator XAnimator { get { return _ator; } }
+ public float Height { get { return _dummy_height; } }
+ public float Radius { get { return _radius; } }
+ public Vector3 RadiusCenter
+ {
+ get { return transform.position + transform.rotation * ((_present_data.BoundRadiusOffset != null && _present_data.BoundRadiusOffset.Length > 0) ? new Vector3(_present_data.BoundRadiusOffset[0], 0, _present_data.BoundRadiusOffset[1]) : Vector3.zero); }
+ }
+
+ void Update()
+ {
+ if (_hoster == null) return;
+
+ //trigger and present
+ if (null != _trigger && !_ator.IsInTransition(0))
+ {
+ if (_trigger == "ToBeHit")
+ {
+ _ator.Play("Present", 0);
+ }
+ else
+ _ator.SetTrigger(_trigger);
+
+ _trigger = null;
+ }
+ else
+ {
+ float last_elapsed = _elapsed;
+ _elapsed += Time.deltaTime;
+
+ if (_data.State == XBeHitState.Hit_Freezed)
+ {
+ float deltaH = -(_deltaH / _present_straight) * Time.deltaTime;
+ transform.Translate(0, deltaH, 0, Space.World);
+
+ if (_elapsed > _time_total)
+ {
+ Cancel();
+ }
+ }
+ else
+ {
+ switch (_phase)
+ {
+ case XBeHitPhase.Hit_Present:
+ {
+ if (_elapsed > _present_straight)
+ {
+ _elapsed = _present_straight;
+ _ator.speed = 1;
+
+ if ((_change_to_fly || _data.State == XBeHitState.Hit_Fly) && _present_data.HitFly!=null&&_present_data.HitFly.Length > 0)
+ {
+ _ator.SetTrigger("ToBeHit_Landing");
+ _phase = XBeHitPhase.Hit_Landing;
+ }
+ else
+ {
+ _ator.SetTrigger("ToBeHit_Hard");
+ _phase = XBeHitPhase.Hit_Hard;
+ }
+ }
+
+ CalcDeltaPos(Time.deltaTime, last_elapsed);
+ float deltaH = -(_deltaH / _present_straight) * Time.deltaTime;
+
+ if (_offset < 0)
+ {
+ float move = Mathf.Sqrt(_delta_x * _delta_x + _delta_z * _delta_z);
+ float dis = (_hoster.gameObject.transform.position - gameObject.transform.position).magnitude;
+
+ if (move > dis - 0.5)
+ {
+ _delta_x = 0;
+ _delta_z = 0;
+ }
+ }
+ transform.Translate(_delta_x, _delta_y + deltaH, _delta_z, Space.World);
+
+ } break;
+ case XBeHitPhase.Hit_Landing:
+ {
+ if (_elapsed > _present_straight + _landing_time)
+ {
+ _ator.SetTrigger("ToBeHit_Hard");
+ _phase = XBeHitPhase.Hit_Hard;
+ }
+ } break;
+ case XBeHitPhase.Hit_Hard:
+ {
+ if (_elapsed > _present_straight + _landing_time + _hard_straight)
+ {
+ _ator.speed = 1;
+ _ator.SetTrigger("ToBeHit_GetUp");
+ _phase = XBeHitPhase.Hit_GetUp;
+ }
+ else
+ {
+ if (!_loop_hard) _ator.speed = _hard_straight_time / _hard_straight;
+ }
+ } break;
+ case XBeHitPhase.Hit_GetUp:
+ {
+ if (_elapsed > _time_total)
+ {
+ Cancel();
+ }
+ } break;
+ }
+ }
+ }
+ }
+
+ protected void Cancel()
+ {
+ _elapsed = 0;
+
+ _rticalV = 0;
+ _gravity = 0;
+
+ _deltaH = 0;
+
+ _ator.speed = 1;
+
+ DestroyFx();
+
+ _data = null;
+ _hoster = null;
+
+ _ator.SetTrigger("ToStand");
+ }
+
+ public void Begin(XSkillHoster hoster, XHitData data, Vector3 dir, bool bAttackOnHitDown)
+ {
+ if (data.State == XBeHitState.Hit_Free) return;
+
+ _hoster = hoster;
+ /*if (!bAttackOnHitDown && data.Hit_State == XBeHitState.Hit_Fly)
+ {
+ if (_elapsed > _land_time) return;
+ }*/
+
+ _deltaH = transform.position.y;
+
+ _data = data;
+ _change_to_fly = (_data.State == XBeHitState.Hit_Back || _data.State == XBeHitState.Hit_Roll) && _deltaH > 0.1f;
+
+ DestroyFx();
+ BuildAnimation(data);
+
+ if (_data.State == XBeHitState.Hit_Freezed)
+ {
+ _time_total = _data.FreezeDuration;
+ _present_animation_factor = 1;
+ }
+ else
+ {
+ float OffsetTimeScale_Offset = 1;
+ float OffsetTimeScale_Height = 1;
+ float OffsetTimeScale_Present = 1;
+ float OffsetTimeScale_Hard = 1;
+
+ switch (_data.State)
+ {
+ case XBeHitState.Hit_Back:
+ {
+ if (_change_to_fly)
+ {
+ OffsetTimeScale_Offset = _present_data.HitFlyOffsetTimeScale[0] == 0 ? 1 : _present_data.HitFlyOffsetTimeScale[0];
+ OffsetTimeScale_Height = _present_data.HitFlyOffsetTimeScale[1] == 0 ? 1 : _present_data.HitFlyOffsetTimeScale[1];
+ OffsetTimeScale_Present = _present_data.HitFlyOffsetTimeScale[2] == 0 ? 1 : _present_data.HitFlyOffsetTimeScale[2];
+ OffsetTimeScale_Hard = _present_data.HitFlyOffsetTimeScale[3] == 0 ? 1 : _present_data.HitFlyOffsetTimeScale[3];
+ }
+ else
+ {
+ OffsetTimeScale_Offset = _present_data.HitBackOffsetTimeScale[0] == 0 ? 1 : _present_data.HitBackOffsetTimeScale[0];
+ OffsetTimeScale_Present = _present_data.HitBackOffsetTimeScale[1] == 0 ? 1 : _present_data.HitBackOffsetTimeScale[1];
+ OffsetTimeScale_Hard = _present_data.HitBackOffsetTimeScale[2] == 0 ? 1 : _present_data.HitBackOffsetTimeScale[2];
+ }
+ } break;
+ case XBeHitState.Hit_Fly:
+ {
+ OffsetTimeScale_Offset = _present_data.HitFlyOffsetTimeScale[0] == 0 ? 1 : _present_data.HitFlyOffsetTimeScale[0];
+ OffsetTimeScale_Height = _present_data.HitFlyOffsetTimeScale[1] == 0 ? 1 : _present_data.HitFlyOffsetTimeScale[1];
+ OffsetTimeScale_Present = _present_data.HitFlyOffsetTimeScale[2] == 0 ? 1 : _present_data.HitFlyOffsetTimeScale[2];
+ OffsetTimeScale_Hard = _present_data.HitFlyOffsetTimeScale[3] == 0 ? 1 : _present_data.HitFlyOffsetTimeScale[3];
+ } break;
+ case XBeHitState.Hit_Roll:
+ {
+ if (_change_to_fly)
+ {
+ OffsetTimeScale_Offset = _present_data.HitFlyOffsetTimeScale[0] == 0 ? 1 : _present_data.HitFlyOffsetTimeScale[0];
+ OffsetTimeScale_Height = _present_data.HitFlyOffsetTimeScale[1] == 0 ? 1 : _present_data.HitFlyOffsetTimeScale[1];
+ OffsetTimeScale_Present = _present_data.HitFlyOffsetTimeScale[2] == 0 ? 1 : _present_data.HitFlyOffsetTimeScale[2];
+ OffsetTimeScale_Hard = _present_data.HitFlyOffsetTimeScale[3] == 0 ? 1 : _present_data.HitFlyOffsetTimeScale[3];
+ }
+ else
+ {
+ OffsetTimeScale_Offset = _present_data.HitRollOffsetTimeScale[0] == 0 ? 1 : _present_data.HitRollOffsetTimeScale[0];
+ OffsetTimeScale_Present = _present_data.HitRollOffsetTimeScale[1] == 0 ? 1 : _present_data.HitRollOffsetTimeScale[1];
+ OffsetTimeScale_Hard = _present_data.HitRollOffsetTimeScale[2] == 0 ? 1 : _present_data.HitRollOffsetTimeScale[2];
+ }
+ } break;
+ }
+
+ _present_straight = (_change_to_fly ? (data.Additional_Using_Default ? XGloabelConfLibrary.Hit_PresentStraight : data.Additional_Hit_Time_Present_Straight) : data.Time_Present_Straight) * OffsetTimeScale_Present;
+ _hard_straight = (_change_to_fly ? (data.Additional_Using_Default ? XGloabelConfLibrary.Hit_HardStraight : data.Additional_Hit_Time_Hard_Straight) : data.Time_Hard_Straight) * OffsetTimeScale_Hard;
+ _height = (_change_to_fly ? (data.Additional_Using_Default ? XGloabelConfLibrary.Hit_Height : data.Additional_Hit_Height) : data.Height) * OffsetTimeScale_Height;
+ _offset = (_change_to_fly ? (data.Additional_Using_Default ? XGloabelConfLibrary.Hit_Offset : data.Additional_Hit_Offset) : data.Offset) * OffsetTimeScale_Offset;
+
+ _dir = dir;
+ _time_total = _present_straight + _landing_time + _hard_straight + _getup_time;
+ _bcurve = data.CurveUsing;
+
+ _present_animation_factor = _present_anim_time / _present_straight;
+
+ //need re-calculate between hurt and broken
+ {
+ if (_bcurve)
+ {
+ if (_present_data.HitFly != null && _present_data.HitCurves != null)
+ {
+ IXCurve raw_h = ((_change_to_fly || _data.State == XBeHitState.Hit_Fly) && _present_data.HitFly.Length > 0) ? XResourceLoaderMgr.singleton.GetCurve("Curve/" + _present_data.CurveLocation + _present_data.HitCurves[4]) : null;
+ IXCurve raw_v = ((_change_to_fly || _data.State == XBeHitState.Hit_Fly) && _present_data.HitFly.Length > 0) ?
+ XResourceLoaderMgr.singleton.GetCurve("Curve/" + _present_data.CurveLocation + _present_data.HitCurves[3]) :
+ ((_data.State == XBeHitState.Hit_Roll && _present_data.Hit_Roll.Length > 0) ?
+ XResourceLoaderMgr.singleton.GetCurve("Curve/" + _present_data.CurveLocation + _present_data.HitCurves[5]) :
+ (_data.State == XBeHitState.Hit_Back ? XResourceLoaderMgr.singleton.GetCurve("Curve/" + _present_data.CurveLocation + _present_data.HitCurves[(int)data.State_Animation]) :
+ XResourceLoaderMgr.singleton.GetCurve("Curve/" + _present_data.CurveLocation + _present_data.HitCurves[0])));
+
+
+
+ _curve_h = raw_h != null ? raw_h : null;
+ _curve_v = raw_v;
+
+ _curve_height_scale = (raw_h == null || raw_h.GetMaxValue() == 0) ? 1 : _height / raw_h.GetMaxValue();
+ _curve_offset_scale = raw_v.GetMaxValue() == 0 ? 1 : _offset / raw_v.GetMaxValue();
+ }
+ }
+ }
+ }
+
+ //play fx here
+ if (data.Fx != null) PlayHitFx(data.Fx, data.Fx_Follow);
+
+ _elapsed = 0;
+
+ ReadyToGo(data);
+
+ _trigger = _data.State == XBeHitState.Hit_Freezed ? (_data.FreezePresent ? "ToFreezed" : null) : "ToBeHit";
+ _ator.speed = _trigger == null ? 0 : _present_animation_factor;
+
+ _phase = XBeHitPhase.Hit_Present;
+ }
+
+ protected void ReadyToGo(XHitData data)
+ {
+ if (_data.State == XBeHitState.Hit_Freezed) return;
+
+ _pos.x = transform.position.x;
+ _pos.y = transform.position.z;
+
+ Vector3 destination = transform.position + _dir * _offset;
+
+ _des.x = destination.x;
+ _des.y = destination.z;
+
+ if (_bcurve)
+ {
+ _curve_height_time_scale = _curve_h == null ? 1 : _present_straight / _curve_h.GetTime(_curve_h.length - 1);
+ _curve_offset_time_scale = _present_straight / _curve_v.GetTime(_curve_v.length - 1);
+
+ _last_offset = 0;
+ _last_height = 0;
+ }
+ else
+ {
+ _factor = XCommon.singleton.GetSmoothFactor((_pos - _des).magnitude, _present_straight, 0.01f);
+
+ _rticalV = ((!_change_to_fly && _data.State != XBeHitState.Hit_Fly)) ? 0 : (_height * 4.0f) / _present_straight;
+ _gravity = _rticalV / _present_straight * 2.0f;
+ }
+ }
+
+ private void BuildAnimation(XHitData data)
+ {
+ string[] anims = null;
+ switch (data.State)
+ {
+ case XBeHitState.Hit_Back:
+ {
+ if (_change_to_fly)
+ {
+ anims = _present_data.HitFly != null && _present_data.HitFly.Length > 0 ? _present_data.HitFly : _present_data.Hit_f;
+ }
+ else
+ {
+ switch (data.State_Animation)
+ {
+ case XBeHitState_Animation.Hit_Back_Front: anims = _present_data.Hit_f; break;
+ case XBeHitState_Animation.Hit_Back_Left: anims = _present_data.Hit_l; break;
+ case XBeHitState_Animation.Hit_Back_Right: anims = _present_data.Hit_r; break;
+ }
+ }
+ } break;
+ case XBeHitState.Hit_Roll:
+ {
+ anims = _change_to_fly ?
+ _present_data.HitFly != null && _present_data.HitFly.Length > 0 ? _present_data.HitFly : _present_data.Hit_f :
+ _present_data.HitFly != null && _present_data.HitFly.Length > 0 ? _present_data.Hit_Roll : _present_data.Hit_f;
+ } break;
+ case XBeHitState.Hit_Fly:
+ {
+ anims = _present_data.HitFly != null && _present_data.HitFly.Length > 0 ? _present_data.HitFly : _present_data.Hit_f;
+ } break;
+ case XBeHitState.Hit_Freezed:
+ {
+ if (_data.FreezePresent)
+ {
+ string freeze = "Animation/" + _present_data.AnimLocation + _present_data.Freeze;
+ AnimationClip freeze_clip = XResourceLoaderMgr.singleton.GetSharedResource<AnimationClip>(freeze, ".anim");
+ _present_anim_time = freeze_clip.length;
+ _oVerrideController["Freezed"] = freeze_clip;
+ }
+ return;
+ }
+ }
+ if (anims == null)
+ return;
+ int idx = 0;
+
+ string clipname = "Animation/" + _present_data.AnimLocation + anims[idx++];
+ AnimationClip clip = XResourceLoaderMgr.singleton.GetSharedResource<AnimationClip>(clipname, ".anim");
+ _present_anim_time = clip.length;
+ _oVerrideController["PresentStraight"] = clip;
+
+ if ((_change_to_fly || data.State == XBeHitState.Hit_Fly) && _present_data.HitFly != null && _present_data.HitFly.Length > 0)
+ {
+ clipname = "Animation/" + _present_data.AnimLocation + anims[idx++];
+ clip = XResourceLoaderMgr.singleton.GetSharedResource<AnimationClip>(clipname, ".anim");
+ _landing_time = clip.length;
+ }
+ else
+ {
+ _landing_time = 0;
+ }
+
+ clipname = "Animation/" + _present_data.AnimLocation + anims[idx++];
+ clip = XResourceLoaderMgr.singleton.GetSharedResource<AnimationClip>(clipname, ".anim");
+ _oVerrideController["HardStraight"] = clip;
+ _loop_hard = (clip.wrapMode == WrapMode.Loop);
+ _hard_straight_time = clip.length;
+
+ clipname = "Animation/" + _present_data.AnimLocation + anims[idx++];
+ clip = XResourceLoaderMgr.singleton.GetSharedResource<AnimationClip>(clipname, ".anim");
+ _getup_time = clip.length;
+ _oVerrideController["GetUp"] = clip;
+ }
+
+ private void PlayHitFx(string fx, bool follow)
+ {
+ if (fx.Length == 0) return;
+
+ GameObject o = Resources.Load(fx) as GameObject;
+ _hit_fx = GameObject.Instantiate(o) as GameObject;
+
+ _binded_bone = transform.Find("Bip001/Bip001 Pelvis/Bip001 Spine");
+ Transform parent = (_binded_bone == null) ? gameObject.transform : _binded_bone;
+
+ if (follow)
+ {
+ _hit_fx.transform.parent = parent;
+ _hit_fx.transform.localPosition = Vector3.zero;
+ _hit_fx.transform.localRotation = Quaternion.identity;
+ _hit_fx.transform.localScale = Vector3.one;
+ }
+ else
+ {
+ _hit_fx.transform.position = parent.position;
+ _hit_fx.transform.rotation = parent.rotation;
+ }
+
+ ParticleSystem[] systems = _hit_fx.GetComponentsInChildren<ParticleSystem>();
+ foreach (ParticleSystem system in systems)
+ {
+ system.Play();
+ }
+ }
+
+ private void DestroyFx()
+ {
+ if (_hit_fx != null)
+ {
+ ParticleSystem[] systems = _hit_fx.GetComponentsInChildren<ParticleSystem>();
+ foreach (ParticleSystem system in systems)
+ {
+ system.Stop();
+ }
+
+ _hit_fx.transform.parent = null;
+ GameObject.Destroy(_hit_fx);
+ }
+ _hit_fx = null;
+ }
+
+ private void CalcDeltaPos(float deltaTime, float last_elapsed)
+ {
+ Vector2 delta = Vector2.zero;
+ float h = 0;
+
+ if (_bcurve)
+ {
+ float ev = (_elapsed) / _curve_offset_time_scale;
+ float eh = (_elapsed) / _curve_height_time_scale;
+
+ float c_v = _curve_v.Evaluate(ev) * _curve_offset_scale;
+ float c_h = _curve_h == null ? 0 : _curve_h.Evaluate(eh) * _curve_height_scale;
+
+ Vector3 v = _dir * (c_v - _last_offset);
+ delta.x = v.x; delta.y = v.z;
+
+ h = c_h - _last_height;
+
+ _last_height = c_h;
+ _last_offset = c_v;
+ }
+ else
+ {
+ float v1 = _rticalV - _gravity * (last_elapsed);
+ float v2 = _rticalV - _gravity * (_elapsed);
+
+ h = (v1 + v2) / 2.0f * deltaTime;
+
+ _pos.x = transform.position.x;
+ _pos.y = transform.position.z;
+
+ delta = (_des - _pos) * Mathf.Min(1.0f, _factor * deltaTime);
+ }
+
+ _delta_x = delta.x;
+ _delta_y = h;
+ _delta_z = delta.y;
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHit.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHit.cs.meta
new file mode 100644
index 00000000..db4c006a
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHit.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 014e229e082733a4fa0f8dc5ff4e592a
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHoster.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHoster.cs
new file mode 100644
index 00000000..f8d091a9
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHoster.cs
@@ -0,0 +1,2081 @@
+#if UNITY_EDITOR
+using System;
+using UnityEngine;
+using System.Collections.Generic;
+using UnityEditor;
+using XUtliPoolLib;
+using UnityEditorInternal;
+
+namespace XEditor
+{
+ public class XSkillHoster : MonoBehaviour
+ {
+ public class XChargeSetting
+ {
+ public XChargeData data;
+ public float offset;
+ }
+
+ [SerializeField]
+ private XSkillData _xData = null;
+ [SerializeField]
+ private XSkillDataExtra _xDataExtra = null;
+ [SerializeField]
+ private XEditorData _xEditorData = null;
+ [SerializeField]
+ private XConfigData _xConfigData = null;
+
+ private XSkillData _xOuterData = null;
+
+ private enum DummyState { Idle, Move, Fire };
+ private DummyState _state = DummyState.Idle;
+
+ private Animator _ator = null;
+ private XSkillCamera _camera = null;
+
+ private int _combined_id = 0;
+
+ private float _to = 0;
+ private float _from = 0;
+
+ private float _delta = 0;
+ private float _fire_time = 0;
+ private float _time_offset = 0;
+
+ private string _trigger = null;
+ private bool _execute = false;
+ private bool _anim_init = false;
+ //private bool _effectual = false;
+ private bool _freezed = false;
+ private XSkillCharge _update = null;
+ private XSkillManipulate _manipulate = null;
+
+ GameObject _target = null;
+ List<GameObject> _mob_unit = new List<GameObject>();
+
+ AudioSource _audio_motion = null;
+ AudioSource _audio_action = null;
+ AudioSource _audio_skill = null;
+ AudioSource _audio_behit = null;
+
+ XFmod _emitter = null;
+
+ private XCameraShake _xcamera_effect = null;
+
+ private List<uint> _combinedToken = new List<uint>();
+ private List<uint> _presentToken = new List<uint>();
+ private List<uint> _logicalToken = new List<uint>();
+ private List<XSkillData> _combinedlist = new List<XSkillData>();
+
+ private XSkillData _current = null;
+
+ private float _last_swype_time = 0;
+ private int _jaCount = 0;
+ private bool _skill_when_move = false;
+
+ public float defaultFov = 45;
+
+ [HideInInspector]
+ public XSkillCamera Camera { get { return _camera; } }
+ [HideInInspector]
+ public GameObject Target { get { return _target; } }
+ [HideInInspector]
+ public XFmod Emitter { get { return _emitter; } set { _emitter = value; } }
+ [HideInInspector]
+ public static bool Quit { get; set; }
+ [HideInInspector]
+ public static XSerialized<XSkillData> sData = new XSerialized<XSkillData>();
+ [HideInInspector]
+ public static XSerialized<XEditorData> sEditorData = new XSerialized<XEditorData>();
+ [HideInInspector]
+ public static XSerialized<XConfigData> sConfigData = new XSerialized<XConfigData>();
+ [HideInInspector]
+ public List<XSkillData> ComboSkills = new List<XSkillData>();
+ [HideInInspector]
+ public int nHotID = 0;
+ [HideInInspector]
+ public Vector3 nResultForward = Vector3.zero;
+ [HideInInspector]
+ public Transform ShownTransform = null;
+ [HideInInspector]
+ public AnimatorOverrideController oVerrideController = null;
+ [HideInInspector]
+ public float ir = 0;
+ [HideInInspector]
+ public float or = 0;
+
+ [HideInInspector]
+ public Vector3 ControlDir = Vector3.zero;
+
+ private XEntityPresentation.RowData _present_data = null;
+
+ void Awake()
+ {
+ ShownTransform = transform;
+ }
+
+ void Start()
+ {
+ _state = DummyState.Idle;
+
+ if (oVerrideController == null) BuildOverride();
+
+ _camera = new XSkillCamera(gameObject);
+
+ _camera.Initialize();
+ _camera.UnityCamera.fieldOfView = defaultFov;
+
+ AudioListener audiolistener = _camera.UnityCamera.gameObject.GetComponent<AudioListener>();
+ Component.DestroyImmediate(audiolistener);
+
+ _camera.UnityCamera.gameObject.AddComponent<FMOD_Listener>();
+
+ Light light = _camera.UnityCamera.gameObject.AddComponent<Light>() as Light;
+ light.type = LightType.Directional;
+ light.intensity = 0.5f;
+
+ RebuildSkillAniamtion();
+
+ Application.targetFrameRate = 60;
+
+ if (!string.IsNullOrEmpty(SkillData.CameraPostEffect.Effect))
+ {
+ //ImageEffectBase iebase = _camera.UnityCamera.gameObject.AddComponent<RadialBlur>() as ImageEffectBase;
+ //ImageEffectBase iebase = UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(_camera.UnityCamera.gameObject, "Assets/Scripts/XEditor/XSkillEditor/XSkillHoster.cs (135,42)", SkillData.CameraPostEffect.Effect) as ImageEffectBase;
+ //iebase.shader = SkillDataExtra.PostEffectEx.Shader;
+
+ Behaviour o = _camera.UnityCamera.GetComponent(SkillData.CameraPostEffect.Effect) as Behaviour;
+ if(o!=null)
+ o.enabled = false;
+ }
+ }
+
+ public void RebuildSkillAniamtion()
+ {
+ AnimationClip clip = Resources.Load(SkillData.ClipName) as AnimationClip;
+
+ if (oVerrideController == null) BuildOverride();
+
+ if (SkillData.TypeToken == 0)
+ {
+ string motion = XSkillData.JaOverrideMap[SkillData.SkillPosition];
+ oVerrideController[motion] = clip;
+
+ foreach (XJADataExtraEx ja in SkillDataExtra.JaEx)
+ {
+ if (SkillData.SkillPosition == 15) //ToJA_QTE
+ continue;
+
+ if (ja.Next != null && ja.Next.Name.Length > 0) oVerrideController[XSkillData.JaOverrideMap[ja.Next.SkillPosition]] = Resources.Load(ja.Next.ClipName) as AnimationClip;
+ if (ja.Ja != null && ja.Ja.Name.Length > 0) oVerrideController[XSkillData.JaOverrideMap[ja.Ja.SkillPosition]] = Resources.Load(ja.Ja.ClipName) as AnimationClip;
+ }
+ }
+ else if (SkillData.TypeToken == 3)
+ {
+ for (int i = 0; i < SkillData.Combined.Count; i++)
+ {
+ oVerrideController[XSkillData.CombinedOverrideMap[i]] = SkillDataExtra.CombinedEx[i].Clip;
+ }
+ }
+ else
+ {
+ oVerrideController["Art"] = clip;
+ }
+
+ _present_data = XAnimationLibrary.AssociatedAnimations((uint)_xConfigData.Player);
+
+ oVerrideController["Idle"] = Resources.Load("Animation/" + _present_data.AnimLocation + _present_data.AttackIdle) as AnimationClip;
+ oVerrideController["Run"] = Resources.Load("Animation/" + _present_data.AnimLocation + _present_data.AttackRun) as AnimationClip;
+ oVerrideController["Walk"] = Resources.Load("Animation/" + _present_data.AnimLocation + _present_data.AttackWalk) as AnimationClip;
+ }
+
+ private void BuildOverride()
+ {
+ oVerrideController = new AnimatorOverrideController();
+
+ _ator = GetComponent<Animator>();
+ if (_ator == null)
+ {
+ _ator = gameObject.AddComponent<Animator>();
+ _ator.runtimeAnimatorController = AssetDatabase.LoadAssetAtPath<UnityEditor.Animations.AnimatorController>("Assets/Resources/Controller/XAnimator.controller");
+ }
+ oVerrideController.runtimeAnimatorController = _ator.runtimeAnimatorController;
+ _ator.runtimeAnimatorController = oVerrideController;
+
+ }
+
+ void OnDrawGizmos()
+ {
+ DrawManipulationFileds();
+
+ if (nHotID < 0 || CurrentSkillData.Result == null || nHotID >= CurrentSkillData.Result.Count) return;
+
+ if (ShownTransform == null) ShownTransform = transform;
+
+ float offset_x = CurrentSkillData.Result[nHotID].LongAttackEffect ? CurrentSkillData.Result[nHotID].LongAttackData.At_X : CurrentSkillData.Result[nHotID].Offset_X;
+ float offset_z = CurrentSkillData.Result[nHotID].LongAttackEffect ? CurrentSkillData.Result[nHotID].LongAttackData.At_Z : CurrentSkillData.Result[nHotID].Offset_Z;
+
+ Vector3 offset = ShownTransform.rotation * new Vector3(offset_x, 0, offset_z);
+
+ Color defaultColor = Gizmos.color;
+ Gizmos.color = Color.red;
+
+ Matrix4x4 defaultMatrix = Gizmos.matrix;
+ if (ShownTransform == transform)
+ {
+ ShownTransform.position += offset;
+ Gizmos.matrix = ShownTransform.localToWorldMatrix;
+ ShownTransform.position -= offset;
+ }
+ else //bullet
+ Gizmos.matrix = ShownTransform.localToWorldMatrix;
+
+ if (CurrentSkillData.Result[nHotID].LongAttackEffect)
+ {
+ if (CurrentSkillData.Result[nHotID].LongAttackData.TriggerAtEnd)
+ {
+ float m_Theta = 0.01f;
+
+ Vector3 beginPoint = Vector3.zero;
+ Vector3 firstPoint = Vector3.zero;
+
+ for (float theta = 0; theta < 2 * Mathf.PI; theta += m_Theta)
+ {
+ float x = CurrentSkillData.Result[nHotID].Range / ShownTransform.localScale.y * Mathf.Cos(theta);
+ float z = CurrentSkillData.Result[nHotID].Range / ShownTransform.localScale.y * Mathf.Sin(theta);
+ Vector3 endPoint = new Vector3(x, 0, z);
+ if (theta == 0)
+ {
+ firstPoint = endPoint;
+ }
+ else
+ {
+ Gizmos.DrawLine(beginPoint, endPoint);
+ }
+ beginPoint = endPoint;
+ }
+
+ Gizmos.DrawLine(firstPoint, beginPoint);
+
+ if (CurrentSkillData.Result[nHotID].Low_Range > 0)
+ {
+ m_Theta = 0.01f;
+
+ beginPoint = Vector3.zero;
+ firstPoint = Vector3.zero;
+
+ for (float theta = 0; theta < 2 * Mathf.PI; theta += m_Theta)
+ {
+ float x = CurrentSkillData.Result[nHotID].Low_Range / ShownTransform.localScale.y * Mathf.Cos(theta);
+ float z = CurrentSkillData.Result[nHotID].Low_Range / ShownTransform.localScale.y * Mathf.Sin(theta);
+ Vector3 endPoint = new Vector3(x, 0, z);
+ if (theta == 0)
+ {
+ firstPoint = endPoint;
+ }
+ else
+ {
+ Gizmos.DrawLine(beginPoint, endPoint);
+ }
+ beginPoint = endPoint;
+ }
+
+ Gizmos.DrawLine(firstPoint, beginPoint);
+ }
+ }
+ else
+ {
+ if (CurrentSkillData.Result[nHotID].LongAttackData.Type == XResultBulletType.Ring)
+ {
+ float m_Theta = 0.01f;
+
+ Vector3 beginPoint = Vector3.zero;
+ Vector3 firstPoint = Vector3.zero;
+
+ for (float theta = 0; theta < 2 * Mathf.PI; theta += m_Theta)
+ {
+ float x = ir / ShownTransform.localScale.y * Mathf.Cos(theta);
+ float z = ir / ShownTransform.localScale.y * Mathf.Sin(theta);
+ Vector3 endPoint = new Vector3(x, 0, z);
+ if (theta == 0)
+ {
+ firstPoint = endPoint;
+ }
+ else
+ {
+ Gizmos.DrawLine(beginPoint, endPoint);
+ }
+ beginPoint = endPoint;
+ }
+
+ Gizmos.DrawLine(firstPoint, beginPoint);
+
+ Vector3 beginPoint2 = Vector3.zero;
+ Vector3 firstPoint2 = Vector3.zero;
+
+ for (float theta = 0; theta < 2 * Mathf.PI; theta += m_Theta)
+ {
+ float x = or / ShownTransform.localScale.y * Mathf.Cos(theta);
+ float z = or / ShownTransform.localScale.y * Mathf.Sin(theta);
+ Vector3 endPoint = new Vector3(x, 0, z);
+ if (theta == 0)
+ {
+ firstPoint2 = endPoint;
+ }
+ else
+ {
+ Gizmos.DrawLine(beginPoint2, endPoint);
+ }
+ beginPoint2 = endPoint;
+ }
+
+ Gizmos.DrawLine(firstPoint2, beginPoint2);
+ }
+ else
+ {
+ float m_Theta = 0.01f;
+
+ Vector3 beginPoint = Vector3.zero;
+ Vector3 firstPoint = Vector3.zero;
+
+ for (float theta = 0; theta < 2 * Mathf.PI; theta += m_Theta)
+ {
+ float x = CurrentSkillData.Result[nHotID].LongAttackData.Radius / ShownTransform.localScale.y * Mathf.Cos(theta);
+ float z = CurrentSkillData.Result[nHotID].LongAttackData.Radius / ShownTransform.localScale.y * Mathf.Sin(theta);
+ Vector3 endPoint = new Vector3(x, 0, z);
+ if (theta == 0)
+ {
+ firstPoint = endPoint;
+ }
+ else
+ {
+ Gizmos.DrawLine(beginPoint, endPoint);
+ }
+ beginPoint = endPoint;
+ }
+
+ Gizmos.DrawLine(firstPoint, beginPoint);
+ }
+ }
+ }
+ else
+ {
+ if (CurrentSkillData.Result[nHotID].Sector_Type)
+ {
+ float m_Theta = 0.01f;
+
+ Vector3 beginPoint = Vector3.zero;
+ Vector3 firstPoint = Vector3.zero;
+
+ for (float theta = 0; theta < 2 * Mathf.PI; theta += m_Theta)
+ {
+ float x = CurrentSkillData.Result[nHotID].Range / ShownTransform.localScale.y * Mathf.Cos(theta);
+ float z = CurrentSkillData.Result[nHotID].Range / ShownTransform.localScale.y * Mathf.Sin(theta);
+ Vector3 endPoint = new Vector3(x, 0, z);
+ if (theta == 0)
+ {
+ firstPoint = endPoint;
+ }
+ else
+ {
+ Gizmos.DrawLine(beginPoint, endPoint);
+ }
+ beginPoint = endPoint;
+ }
+
+ Gizmos.DrawLine(firstPoint, beginPoint);
+
+ if (CurrentSkillData.Result[nHotID].Low_Range > 0)
+ {
+ m_Theta = 0.01f;
+
+ beginPoint = Vector3.zero;
+ firstPoint = Vector3.zero;
+
+ for (float theta = 0; theta < 2 * Mathf.PI; theta += m_Theta)
+ {
+ float x = CurrentSkillData.Result[nHotID].Range / ShownTransform.localScale.y * Mathf.Cos(theta);
+ float z = CurrentSkillData.Result[nHotID].Range / ShownTransform.localScale.y * Mathf.Sin(theta);
+ Vector3 endPoint = new Vector3(x, 0, z);
+ if (theta == 0)
+ {
+ firstPoint = endPoint;
+ }
+ else
+ {
+ Gizmos.DrawLine(beginPoint, endPoint);
+ }
+ beginPoint = endPoint;
+ }
+
+ Gizmos.DrawLine(firstPoint, beginPoint);
+ }
+ }
+ else
+ {
+ Vector3 fr = new Vector3(CurrentSkillData.Result[nHotID].Scope / 2.0f, 0, CurrentSkillData.Result[nHotID].Range / 2.0f);
+ Vector3 fl = new Vector3(CurrentSkillData.Result[nHotID].Scope / 2.0f, 0, CurrentSkillData.Result[nHotID].Rect_HalfEffect ? 0 : (-CurrentSkillData.Result[nHotID].Range / 2.0f));
+ Vector3 br = new Vector3(-CurrentSkillData.Result[nHotID].Scope / 2.0f, 0, CurrentSkillData.Result[nHotID].Range / 2.0f);
+ Vector3 bl = new Vector3(-CurrentSkillData.Result[nHotID].Scope / 2.0f, 0, CurrentSkillData.Result[nHotID].Rect_HalfEffect ? 0 : (-CurrentSkillData.Result[nHotID].Range / 2.0f));
+
+ Gizmos.DrawLine(fr, fl);
+ Gizmos.DrawLine(fl, bl);
+ Gizmos.DrawLine(bl, br);
+ Gizmos.DrawLine(br, fr);
+ }
+ }
+
+ Gizmos.matrix = defaultMatrix;
+ Gizmos.color = defaultColor;
+ }
+
+ void DrawManipulationFileds()
+ {
+ if (_state == DummyState.Fire)
+ {
+ if (_manipulate != null)
+ {
+ foreach (XManipulationData data in _manipulate.Set.Values)
+ {
+ Vector3 offset = transform.rotation * new Vector3(data.OffsetX, 0, data.OffsetZ);
+
+ Color defaultColor = Gizmos.color;
+ Gizmos.color = Color.red;
+
+ Matrix4x4 defaultMatrix = Gizmos.matrix;
+ transform.position += offset;
+ Gizmos.matrix = transform.localToWorldMatrix;
+ transform.position -= offset;
+
+ float m_Theta = 0.01f;
+
+ Vector3 beginPoint = Vector3.zero;
+ Vector3 firstPoint = Vector3.zero;
+
+ for (float theta = 0; theta < 2 * Mathf.PI; theta += m_Theta)
+ {
+ float x = data.Radius / transform.localScale.y * Mathf.Cos(theta);
+ float z = data.Radius / transform.localScale.y * Mathf.Sin(theta);
+ Vector3 endPoint = new Vector3(x, 0, z);
+ if (theta == 0)
+ {
+ firstPoint = endPoint;
+ }
+ else
+ {
+ if (Vector3.Angle(endPoint, transform.forward) < data.Degree * 0.5f)
+ Gizmos.DrawLine(beginPoint, endPoint);
+ }
+ beginPoint = endPoint;
+ }
+
+ if (data.Degree == 360)
+ Gizmos.DrawLine(firstPoint, beginPoint);
+ else
+ {
+ Gizmos.DrawLine(Vector3.zero, XCommon.singleton.HorizontalRotateVetor3(transform.forward, data.Degree * 0.5f, true) * (data.Radius / transform.localScale.y));
+ Gizmos.DrawLine(Vector3.zero, XCommon.singleton.HorizontalRotateVetor3(transform.forward, -data.Degree * 0.5f, true) * (data.Radius / transform.localScale.y));
+ }
+
+ Gizmos.matrix = defaultMatrix;
+ Gizmos.color = defaultColor;
+ }
+ }
+ }
+ else
+ {
+ if (_xData.Manipulation != null)
+ {
+ foreach (XManipulationData data in _xData.Manipulation)
+ {
+ if (data.Radius <= 0 || !_xDataExtra.ManipulationEx[data.Index].Present) continue;
+
+ Vector3 offset = transform.rotation * new Vector3(data.OffsetX, 0, data.OffsetZ);
+
+ Color defaultColor = Gizmos.color;
+ Gizmos.color = Color.red;
+
+ Matrix4x4 defaultMatrix = Gizmos.matrix;
+ transform.position += offset;
+ Gizmos.matrix = transform.localToWorldMatrix;
+ transform.position -= offset;
+
+ float m_Theta = 0.01f;
+
+ Vector3 beginPoint = Vector3.zero;
+ Vector3 firstPoint = Vector3.zero;
+
+ for (float theta = 0; theta < 2 * Mathf.PI; theta += m_Theta)
+ {
+ float x = data.Radius / transform.localScale.y * Mathf.Cos(theta);
+ float z = data.Radius / transform.localScale.y * Mathf.Sin(theta);
+ Vector3 endPoint = new Vector3(x, 0, z);
+ if (theta == 0)
+ {
+ firstPoint = endPoint;
+ }
+ else
+ {
+ if (Vector3.Angle(endPoint, transform.forward) < data.Degree * 0.5f)
+ Gizmos.DrawLine(beginPoint, endPoint);
+ }
+ beginPoint = endPoint;
+ }
+
+ if (data.Degree == 360)
+ Gizmos.DrawLine(firstPoint, beginPoint);
+ else
+ {
+ Gizmos.DrawLine(Vector3.zero, XCommon.singleton.HorizontalRotateVetor3(transform.forward, data.Degree * 0.5f, true) * (data.Radius / transform.localScale.y));
+ Gizmos.DrawLine(Vector3.zero, XCommon.singleton.HorizontalRotateVetor3(transform.forward, -data.Degree * 0.5f, true) * (data.Radius / transform.localScale.y));
+ }
+
+ Gizmos.matrix = defaultMatrix;
+ Gizmos.color = defaultColor;
+ }
+ }
+ }
+ }
+
+ private float _action_framecount = 0;
+ private Rect _rect = new Rect(10, 10, 150, 20);
+
+ void OnGUI()
+ {
+ GUI.Label(_rect, "Action Frame: " + _action_framecount);
+ }
+
+ private int _comboskill_index = 0;
+
+ void Update()
+ {
+ XTimerMgr.singleton.Update(Time.deltaTime);
+ XGesture.singleton.Update();
+ XBulletMgr.singleton.Update(Time.deltaTime);
+
+ if (_update != null)
+ {
+ if (_update.Update(Time.deltaTime)) _update = null;
+ }
+
+ if (_manipulate != null)
+ {
+ _manipulate.Update(Time.deltaTime);
+ }
+
+ ControlDir = Vector3.zero;
+
+ int nh = 0; int nv = 0;
+
+ if (Input.GetKey(KeyCode.W)) nv++;
+ if (Input.GetKey(KeyCode.S)) nv--;
+ if (Input.GetKey(KeyCode.A)) nh--;
+ if (Input.GetKey(KeyCode.D)) nh++;
+
+ Vector3 h = Vector3.right;
+ Vector3 up = Vector3.up;
+ Vector3 v = SceneView.lastActiveSceneView != null ? SceneView.lastActiveSceneView.rotation * Vector3.forward : Vector3.forward; v.y = 0;
+ if (Vector3.Angle (Vector3.forward, v) > 90)
+ nh = -nh;
+
+ Vector3.OrthoNormalize(ref v, ref up, ref h);
+
+ if (_state != DummyState.Fire)
+ {
+ _action_framecount = 0;
+ _comboskill_index = 0;
+
+ //fire skill
+ if (Input.GetKeyDown(KeyCode.Space))
+ {
+ if (_xData.TypeToken == 1 && ComboSkills.Count > 0) oVerrideController["Art"] = Resources.Load(_xData.ClipName) as AnimationClip;
+ _xOuterData = _xData;
+ _combinedlist.Clear();
+ _combined_id = 0;
+ foreach (XCombinedDataExtraEx data in _xDataExtra.CombinedEx)
+ _combinedlist.Add(data.Skill);
+
+ Fire();
+ }
+ else
+ {
+ if (nh != 0 || nv != 0)
+ {
+ ControlDir = h * nh + v * nv;
+ Move(ControlDir);
+
+ if (_state != DummyState.Move) _trigger = "ToMove";
+ _state = DummyState.Move;
+ }
+ else
+ {
+ if (_state == DummyState.Move)
+ _trigger = "ToStand";
+ _state = DummyState.Idle;
+ }
+ }
+ }
+ else
+ {
+ if (_execute || _xOuterData.TypeToken == 3)
+ {
+ if (!_freezed) _delta += Time.deltaTime;
+ _action_framecount = _delta / XCommon.singleton.FrameStep;
+
+ if (_delta > (_xOuterData.TypeToken == 3 ? _xOuterData.Time : _current.Time))
+ {
+ StopFire();
+ }
+ else
+ {
+ if (nh != 0 || nv != 0)
+ {
+ ControlDir = h * nh + v * nv;
+ if (CanAct(ControlDir))
+ {
+ Move(ControlDir);
+ }
+ }
+ else if (_skill_when_move)
+ {
+ _trigger = "ToStand";
+ _skill_when_move = false;
+ }
+ }
+
+ if (Input.GetKeyDown(KeyCode.Space))
+ {
+ if (_comboskill_index < ComboSkills.Count )
+ {
+ XSkillData data = ComboSkills[_comboskill_index];
+
+ if (CanReplacedBy(data))
+ {
+ _comboskill_index++;
+ StopFire();
+
+ _xOuterData = data;
+ _current = data;
+
+ if (data.TypeToken != 3)
+ {
+ oVerrideController["Art"] = XResourceLoaderMgr.singleton.GetSharedResource<AnimationClip>(data.ClipName, ".anim");
+ _trigger = "ToArtSkill";
+ }
+ else
+ {
+ _combinedlist.Clear();
+ for (int i = 0; i < data.Combined.Count; i++)
+ {
+ XSkillData x = XResourceLoaderMgr.singleton.GetData<XSkillData>("SkillPackage/" + XAnimationLibrary.AssociatedAnimations((uint)_xConfigData.Player).SkillLocation + data.Combined[i].Name, ".txt");
+ AnimationClip c = Resources.Load(x.ClipName) as AnimationClip;
+ oVerrideController[XSkillData.CombinedOverrideMap[i]] = c;
+ _combinedlist.Add(x);
+ }
+ _trigger = XSkillData.Combined_Command[0];
+ Combined(0);
+ }
+
+ _state = DummyState.Fire;
+ _fire_time = Time.time;
+ _delta = 0;
+ if (_ator != null)
+ _ator.speed = 0;
+ }
+ }
+ }
+ }
+
+ if (_anim_init)
+ Execute();
+
+ _anim_init = false;
+ }
+ }
+
+ void OnApplicationQuit()
+ {
+ Quit = true;
+
+ sData.Set(_xData);
+ sEditorData.Set(_xEditorData);
+ sConfigData.Set(_xConfigData);
+
+ ir = 0;
+ or = 0;
+ }
+
+ private float _move_follow_speed = 0;
+ private void CameraSkillRotate()
+ {
+ if (_state == DummyState.Fire)
+ {
+ float move_follow_speed_basic = _xOuterData.CameraTurnBack * Time.deltaTime;
+
+ Vector3 playerLookat = GetRotateTo();
+ Vector3 viewForward = XCommon.singleton.Horizontal(_camera.UnityCamera.GetComponent<Camera>().transform.forward);
+
+ float sin = Mathf.Sin(Mathf.Deg2Rad * Vector3.Angle(playerLookat, viewForward) * 0.5f);
+ float move_follow_speed_target = move_follow_speed_basic * sin;
+
+ if (XCommon.singleton.Clockwise(playerLookat, viewForward))
+ move_follow_speed_target *= -1;
+
+ _move_follow_speed += (move_follow_speed_target - _move_follow_speed) * Mathf.Min(1.0f, Time.deltaTime * 6);
+ _camera.YRotate(_move_follow_speed);
+ }
+ }
+
+ void LateUpdate()
+ {
+ _camera.UnityCamera.fieldOfView = defaultFov;
+ CameraSkillRotate();
+ _camera.PostUpdate(Time.deltaTime);
+
+ //face to
+ UpdateRotation();
+
+ if (_xcamera_effect != null) _xcamera_effect.Update(Time.deltaTime);
+
+ if (null != _trigger && _ator != null && !_ator.IsInTransition(0))
+ {
+ if ("ToStand" != _trigger && "ToMove" != _trigger && "EndSkill" != _trigger && "ToUltraShow" != _trigger)
+ _anim_init = true;
+
+ _ator.speed = 1;
+
+ if (SkillData.TypeToken == 3)
+ {
+ int i = 0;
+ for (; i < XSkillData.Combined_Command.Length; i++)
+ {
+ if (_trigger == XSkillData.Combined_Command[i]) break;
+ }
+
+ if (i < XSkillData.Combined_Command.Length)
+ _ator.Play(XSkillData.CombinedOverrideMap[i], 1, _time_offset);
+ else
+ _ator.SetTrigger(_trigger);
+ }
+ else
+ {
+ _ator.SetTrigger(_trigger);
+ }
+
+ _trigger = null;
+ }
+ }
+
+ public void FetchDataBack()
+ {
+ _xData = sData.Get();
+ _xEditorData = sEditorData.Get();
+ _xConfigData = sConfigData.Get();
+
+ XDataBuilder.singleton.HotBuild(this, _xConfigData);
+ XDataBuilder.singleton.HotBuildEx(this, _xConfigData);
+ }
+
+ public XSkillData SkillData
+ {
+ get
+ {
+ if (_xData == null) _xData = new XSkillData();
+ return _xData;
+ }
+ set
+ {
+ //for load data from file.
+ _xData = value;
+ }
+ }
+
+ public XSkillData CurrentSkillData
+ {
+ get
+ {
+ return _state == DummyState.Fire ? _current : SkillData;
+ }
+ }
+
+ public XConfigData ConfigData
+ {
+ get
+ {
+ if (_xConfigData == null) _xConfigData = new XConfigData();
+ return _xConfigData;
+ }
+ set
+ {
+ //for load data from file.
+ _xConfigData = value;
+ }
+ }
+
+ public XEditorData EditorData
+ {
+ get
+ {
+ if (_xEditorData == null) _xEditorData = new XEditorData();
+ return _xEditorData;
+ }
+ }
+
+ public XSkillDataExtra SkillDataExtra
+ {
+ get
+ {
+ if (_xDataExtra == null)_xDataExtra = new XSkillDataExtra();
+ return _xDataExtra;
+ }
+ }
+
+ private void Move(Vector3 dir)
+ {
+ PrepareRotation(dir, _xConfigData.RotateSpeed);
+ transform.Translate(dir * Time.deltaTime * ConfigData.Speed, Space.World);
+ }
+
+ public void PrepareRotation(Vector3 targetDir, float speed)
+ {
+ Vector3 from = transform.forward;
+
+ _from = YRotation(from);
+ float angle = Vector3.Angle(from, targetDir);
+
+ if (XCommon.singleton.Clockwise(from, targetDir))
+ {
+ _to = _from + angle;
+ }
+ else
+ {
+ _to = _from - angle;
+ }
+
+ rotate_speed = speed;
+ }
+
+ public Vector3 GetRotateTo()
+ {
+ return XCommon.singleton.FloatToAngle(_to);
+ }
+
+ private float rotate_speed = 0;
+ private void UpdateRotation()
+ {
+ if (_from != _to)
+ {
+ _from += (_to - _from) * Mathf.Min(1.0f, Time.deltaTime * rotate_speed);
+ transform.rotation = Quaternion.Euler(0, _from, 0);
+ }
+ }
+
+ private float YRotation(Vector3 dir)
+ {
+ float r = Vector3.Angle(Vector3.forward, dir);
+
+ if (XCommon.singleton.Clockwise(Vector3.forward, dir))
+ {
+ return r;
+ }
+ else
+ {
+ return 360.0f - r;
+ }
+ }
+
+ private List<HashSet<XSkillHit>> _hurt_target = new List<HashSet<XSkillHit>>();
+ private void AddHurtTarget(XSkillData data, XSkillHit id, int triggerTime)
+ {
+ if (!data.Result[triggerTime].Loop && /*for multiple trigger end*/!data.Result[triggerTime].LongAttackEffect)
+ _hurt_target[triggerTime].Add(id);
+ }
+
+ private bool IsHurtEntity(XSkillHit id, int triggerTime)
+ {
+ /*
+ * this section not as same as client shows
+ * but in editor mode just using it for simple.
+ */
+ return triggerTime < _hurt_target.Count ? _hurt_target[triggerTime].Contains(id) : false;
+ }
+
+ private void MainCoreExecute()
+ {
+ if (_xOuterData.Fx != null)
+ {
+ foreach (XFxData data in _xOuterData.Fx)
+ {
+ AddedCombinedToken(XTimerMgr.singleton.SetTimer(data.At, Fx, data));
+ }
+ }
+
+ if (_xOuterData.Audio != null)
+ {
+ foreach (XAudioData data in _xOuterData.Audio)
+ {
+ AddedCombinedToken(XTimerMgr.singleton.SetTimer(data.At, Audio, data));
+ }
+ }
+
+ if (_xOuterData.CameraEffect != null)
+ {
+ foreach (XCameraEffectData data in _xOuterData.CameraEffect)
+ {
+ AddedCombinedToken(XTimerMgr.singleton.SetTimer(data.At, Shake, data));
+ }
+ }
+
+ if (!string.IsNullOrEmpty(_xOuterData.CameraMotion.Motion3D))
+ {
+ AddedCombinedToken(XTimerMgr.singleton.SetTimer(_xOuterData.CameraMotion.At, CameraMotion, _xOuterData.CameraMotion));
+ }
+
+ if (!string.IsNullOrEmpty(_xOuterData.CameraPostEffect.Effect))
+ {
+ AddedCombinedToken(XTimerMgr.singleton.SetTimer(_xOuterData.CameraPostEffect.At, CameraPostEffect, _xOuterData.CameraPostEffect));
+ }
+ }
+
+ private void Execute()
+ {
+ if(EditorData.XFrameByFrame) Debug.Break();
+
+ //_effectual = false;
+ _freezed = false;
+ _execute = true;
+
+ _jaCount = 0;
+
+ int count = 0;
+ nHotID = 0;
+
+ _fire_time = Time.time;
+
+ if(_xEditorData.XAutoSelected)
+ Selection.activeObject = gameObject;
+
+ _hurt_target.Clear();
+
+ float play_offset = _xOuterData.TypeToken == 3 ? _xOuterData.Combined[_combined_id].At : 0;
+
+ if (_xOuterData.TypeToken == 3 && _combined_id < _xOuterData.Combined.Count)
+ {
+ //specially
+ AddedTimerToken(XTimerMgr.singleton.SetTimer(_xOuterData.Combined[_combined_id].End - _xOuterData.Combined[_combined_id].At, Combined, _combined_id + 1), true);
+ }
+
+ if (_current.Result != null)
+ {
+ foreach (XResultData data in _current.Result)
+ {
+ _hurt_target.Add(new HashSet<XSkillHit>());
+
+ data.Token = count++;
+ AddedTimerToken(XTimerMgr.singleton.SetTimer(data.At - play_offset, Result, data), true);
+ }
+ }
+
+ if (_current.Charge != null)
+ {
+ XChargeSetting[] setting = new XChargeSetting[_current.Charge.Count];
+ int i = 0;
+
+ foreach (XChargeData data in _current.Charge)
+ {
+ float delay = data.Using_Curve ? 0 : data.At;
+ setting[i] = new XChargeSetting();
+ setting[i].data = data;
+
+ if(delay >= play_offset)
+ {
+ setting[i].offset = 0;
+ AddedTimerToken(XTimerMgr.singleton.SetTimer(delay - play_offset, Charge, setting[i]), true);
+ }
+ else
+ {
+ setting[i].offset = play_offset - delay;
+ AddedTimerToken(XTimerMgr.singleton.SetTimer(0, Charge, setting[i]), true);
+ }
+
+ i++;
+ }
+ }
+
+ if (_xOuterData.TypeToken != 3)
+ {
+ if (_current == _xOuterData && _current.Ja != null)
+ {
+ int i = 0;
+ foreach (XJAData data in _current.Ja)
+ {
+ if (data.Point >= play_offset) AddedTimerToken(XTimerMgr.singleton.SetTimer(data.Point - play_offset, Ja, i++), true);
+ }
+ }
+ }
+
+ if (_current.Manipulation != null)
+ {
+ foreach (XManipulationData data in _current.Manipulation)
+ {
+ if (data.At >= play_offset) AddedTimerToken(XTimerMgr.singleton.SetTimer(data.At - play_offset, Manipulate, data), true);
+ }
+ }
+
+ if (_current.Fx != null && (_xOuterData.TypeToken != 3 || _xOuterData.Combined[_combined_id].Override_Presentation))
+ {
+ foreach (XFxData data in _current.Fx)
+ {
+ if (data.At >= play_offset) AddedTimerToken(XTimerMgr.singleton.SetTimer(data.At - play_offset, Fx, data), false);
+ }
+ }
+
+ if (_current.Audio != null && (_xOuterData.TypeToken != 3 || _xOuterData.Combined[_combined_id].Override_Presentation))
+ {
+ foreach (XAudioData data in _current.Audio)
+ {
+ if (data.At >= play_offset) AddedTimerToken(XTimerMgr.singleton.SetTimer(data.At - play_offset, Audio, data), false);
+ }
+ }
+
+ if (_current.Warning != null)
+ {
+ if (_current.Warning.Count > 0) WarningPosAt = new List<Vector3>[_current.Warning.Count];
+ int i = 0;
+ foreach (XWarningData data in _current.Warning)
+ {
+ WarningPosAt[i] = new List<Vector3>(); i++;
+ if (data.At >= play_offset) AddedTimerToken(XTimerMgr.singleton.SetTimer(data.At - play_offset, Warning, data), false);
+ }
+ }
+
+ if (_current == null) return;
+
+ if (_current.CameraEffect != null && (_xOuterData.TypeToken != 3 || _xOuterData.Combined[_combined_id].Override_Presentation))
+ {
+ foreach (XCameraEffectData data in _current.CameraEffect)
+ {
+ if (data.At >= play_offset) AddedTimerToken(XTimerMgr.singleton.SetTimer(data.At - play_offset, Shake, data), false);
+ }
+ }
+
+ if (_current.CameraMotion != null && !string.IsNullOrEmpty(_current.CameraMotion.Motion3D) && (_xOuterData.TypeToken != 3 || _xOuterData.Combined[_combined_id].Override_Presentation))
+ {
+ if (_current.CameraMotion.At >= play_offset) AddedTimerToken(XTimerMgr.singleton.SetTimer(_current.CameraMotion.At - play_offset, CameraMotion, _current.CameraMotion), false);
+ }
+
+ if (_current.CameraPostEffect != null && !string.IsNullOrEmpty(_current.CameraPostEffect.Effect) && (_xOuterData.TypeToken != 3 || _xOuterData.Combined[_combined_id].Override_Presentation))
+ {
+ if (_current.CameraPostEffect.At >= play_offset) AddedTimerToken(XTimerMgr.singleton.SetTimer(_current.CameraPostEffect.At - play_offset, CameraPostEffect, _current.CameraPostEffect), false);
+ }
+
+ if (_current.Mob != null)
+ {
+ for (int i = 0; i < _current.Mob.Count; i++)
+ if (_current.Mob[i].At >= play_offset) AddedTimerToken(XTimerMgr.singleton.SetTimer(_current.Mob[i].At - play_offset, Mob, _current.Mob[i]), true);
+ }
+ }
+
+ private void Fire()
+ {
+ _current = _xOuterData;
+ _fx.Clear();
+
+ _skill_when_move = (_state == DummyState.Move);
+ _state = DummyState.Fire;
+
+ if (_xOuterData.TypeToken == 0)
+ _trigger = _xOuterData.SkillPosition > 0 ? XSkillData.JA_Command[_xOuterData.SkillPosition] : "ToSkill";
+ else if (_xOuterData.TypeToken == 1)
+ _trigger = "ToArtSkill";
+ else if (_xOuterData.TypeToken == 3)
+ Combined(0);
+ else
+ _trigger = "ToUltraShow";
+
+ FocusTarget();
+
+ _anim_init = false;
+ _delta = 0;
+ }
+
+ private void StopFire(bool cleanup = true)
+ {
+ if (_state != DummyState.Fire) return;
+
+ _state = DummyState.Idle;
+ _trigger = "EndSkill";
+
+ _execute = false;
+
+ for (int i = 0; i < _fx.Count; i++)
+ XFxMgr.singleton.DestroyFx(_fx[i], false);
+ _fx.Clear();
+
+ if (_current.Audio != null)
+ {
+ foreach (XAudioData data in _current.Audio)
+ {
+ AudioSource source = GetAudioSourceByChannel(data.Channel);
+ source.Stop();
+ }
+ }
+
+ if (_manipulate != null) _manipulate.Remove(0);
+
+ if (_current.CameraPostEffect != null && _current.CameraPostEffect.Effect != null && _current.CameraPostEffect.Effect.Length > 0)
+ {
+ Behaviour o = _camera.UnityCamera.GetComponent(_current.CameraPostEffect.Effect) as Behaviour;
+ if(o!=null)
+ o.enabled = false;
+ }
+
+ if (_mob_unit.Count > 0)
+ {
+ for (int i = 0; i < _mob_unit.Count; i++)
+ {
+ if (_mob_unit[i].CompareTag("Finish")) GameObject.DestroyImmediate(_mob_unit[i]);
+ }
+ }
+
+ if (cleanup)
+ {
+ _action_framecount = 0;
+
+ for (int i = 0; i < _outer_fx.Count; i++)
+ XFxMgr.singleton.DestroyFx(_outer_fx[i], false);
+ _outer_fx.Clear();
+
+ if (_xOuterData.Audio != null)
+ {
+ foreach (XAudioData data in _xOuterData.Audio)
+ {
+ AudioSource source = GetAudioSourceByChannel(data.Channel);
+ if (source != null)
+ source.Stop();
+ }
+ }
+
+ _camera.EndEffect(null);
+ _xcamera_effect = null;
+
+ if (_xOuterData.CameraPostEffect != null && _xOuterData.CameraPostEffect.Effect != null && _xOuterData.CameraPostEffect.Effect.Length > 0)
+ {
+ Behaviour o = _camera.UnityCamera.GetComponent(_xOuterData.CameraPostEffect.Effect) as Behaviour;
+ if(o!=null)
+ o.enabled = false;
+ }
+
+ foreach (uint token in _combinedToken)
+ {
+ XTimerMgr.singleton.KillTimer(token);
+ }
+ _combinedToken.Clear();
+ }
+
+ foreach (uint token in _presentToken)
+ {
+ XTimerMgr.singleton.KillTimer(token);
+ }
+
+ _presentToken.Clear();
+
+ foreach (uint token in _logicalToken)
+ {
+ XTimerMgr.singleton.KillTimer(token);
+ }
+
+ _logicalToken.Clear();
+
+ _update = null;
+ _manipulate = null;
+
+ nResultForward = Vector3.zero;
+ Time.timeScale = 1;
+ if (_ator != null)
+ _ator.speed = 1;
+
+ _mob_unit.Clear();
+ _current = null;
+ }
+
+ public void Result(object param)
+ {
+ if (_state != DummyState.Fire) return;
+
+ XResultData data = param as XResultData;
+
+ if (data.Loop)
+ {
+ int i = (data.Index << 16) | 0;
+ LoopResults(i);
+ }
+ else
+ {
+ if (data.Group)
+ {
+ int i = (data.Index << 16) | 0;
+ GroupResults(i);
+ }
+ else
+ {
+ if (data.LongAttackEffect)
+ {
+ Project(data);
+ }
+ else
+ {
+ innerResult(data.Index, transform.forward, transform.position, _current);
+ }
+ }
+ }
+ }
+
+ public void LoopResults(object param)
+ {
+ int i = (int)param;
+ int count = i >> 16;
+ int execute_cout = i & 0xFFFF;
+
+ if (!_current.Result[count].Loop || _current.Result[count].Loop_Count <= execute_cout || _current.Result[count].Cycle <= 0)
+ return;
+
+ if (_current.Result[count].Group)
+ GroupResults((count << 16) | (execute_cout << 8) | 0);
+ else if (_current.Result[count].LongAttackEffect)
+ Project(_current.Result[count]);
+ else
+ {
+ innerResult(count, transform.forward, transform.position, _current);
+ }
+
+ ++execute_cout;
+
+ if(_current.Result[count].Loop_Count > execute_cout)
+ AddedTimerToken(XTimerMgr.singleton.SetTimer(_current.Result[count].Cycle, LoopResults, ((count << 16) | execute_cout)), true);
+ }
+
+ private void GroupResults(object param)
+ {
+ if (_state != DummyState.Fire) return;
+
+ int i = (int)param;
+ int count = i >> 16;
+
+ int group_cout = i & 0x00FF;
+ int loop_cout = (i & 0xFF00) >> 8;
+
+ if (!_current.Result[count].Group || group_cout >= _current.Result[count].Group_Count)
+ return;
+
+ Vector3 face = transform.forward;
+
+ int angle = _current.Result[count].Deviation_Angle + _current.Result[count].Angle_Step * group_cout;
+ angle = _current.Result[count].Clockwise ? angle : -angle;
+
+ if (_current.Result[count].LongAttackEffect)
+ Project(_current.Result[count], angle);
+ else
+ innerResult(count, XCommon.singleton.HorizontalRotateVetor3(face, angle), transform.position, _current);
+
+ group_cout++;
+ if (group_cout < _current.Result[count].Group_Count)
+ {
+ i = (count << 16) | (loop_cout << 8) | group_cout;
+ AddedTimerToken(XTimerMgr.singleton.SetTimer(_current.Result[count].Time_Step, GroupResults, i), true);
+ }
+ }
+
+ public void innerResult(int triggerTime, Vector3 forward, Vector3 pos, XSkillData data, XSkillHit hitted = null)
+ {
+ nHotID = triggerTime;
+
+ if (hitted == null)
+ {
+ pos += XCommon.singleton.VectorToQuaternion(transform.forward) * new Vector3(data.Result[triggerTime].Offset_X, 0, data.Result[triggerTime].Offset_Z);
+ nResultForward = forward;
+
+ XSkillHit[] hits = GameObject.FindObjectsOfType<XSkillHit>();
+
+ foreach (XSkillHit hit in hits)
+ {
+ if (IsHurtEntity(hit, triggerTime)) continue;
+
+ Vector3 dir = hit.RadiusCenter - pos; dir.y = 0;
+ float distance = dir.magnitude;
+
+ if (distance > hit.Radius) distance -= hit.Radius;
+
+ if (dir.sqrMagnitude == 0) dir = forward;
+ dir.Normalize();
+
+ if (IsInField(data, triggerTime, pos, forward, hit.RadiusCenter, Vector3.Angle(forward, dir), distance))
+ {
+ Vector3 vHitDir = data.Result[triggerTime].Affect_Direction == XResultAffectDirection.AttackDir ?
+ (hit.RadiusCenter - pos).normalized :
+ GetRotateTo();
+
+ //_effectual = true;
+
+ AddHurtTarget(data, hit, triggerTime);
+
+ hit.Begin(this, data.Hit[triggerTime], vHitDir, data.Logical.AttackOnHitDown);
+ }
+ }
+ }
+ else
+ {
+ Vector3 vHitDir = data.Result[triggerTime].Affect_Direction == XResultAffectDirection.AttackDir ?
+ (hitted.RadiusCenter - pos) :
+ GetRotateTo();
+
+ vHitDir.y = 0; vHitDir.Normalize();
+ hitted.Begin(this, data.Hit[triggerTime], vHitDir, data.Logical.AttackOnHitDown);
+ }
+ }
+
+ private void Charge(object param)
+ {
+ XChargeSetting setting = param as XChargeSetting;
+ XChargeData data = setting.data;
+
+ XSkillCharge charge = null;
+ if (data.Using_Curve)
+ {
+ if (data.Curve_Forward != null && data.Curve_Forward.Length > 0)
+ {
+ GameObject forward = Resources.Load(data.Curve_Forward) as GameObject;
+ GameObject side = Resources.Load(data.Curve_Side) as GameObject;
+ GameObject up = Resources.Load(data.Curve_Up) as GameObject;
+
+ charge = new XSkillCharge(
+ this,
+ forward != null ? forward.GetComponent<XCurve>() : null,
+ side != null ? side.GetComponent<XCurve>() : null,
+ up != null ? up.GetComponent<XCurve>() : null,
+ data.Using_Up,
+ setting.offset,
+ data.AimTarget,
+ data.StandOnAtEnd,
+ data.Control_Towards);
+ }
+ }
+ else
+ {
+ charge = new XSkillCharge(
+ this,
+ data.End - data.At,
+ data.Offset,
+ data.Height,
+ setting.offset,
+ data.Rotation_Speed,
+ data.AimTarget,
+ data.StandOnAtEnd,
+ data.Control_Towards);
+ }
+
+ _update = charge;
+ _update.Update(Time.deltaTime);
+ }
+
+ protected List<XFx> _fx = new List<XFx>();
+ protected List<XFx> _outer_fx = new List<XFx>();
+
+ public List<Vector3>[] WarningPosAt = null;
+
+ private bool IsPickedInRange(int n, int d)
+ {
+ if(n >= d) return true;
+
+ int i = XCommon.singleton.RandomInt(0, d);
+ return i < n;
+ }
+
+ private void Warning(object param)
+ {
+ XWarningData data = param as XWarningData;
+ WarningPosAt[data.Index].Clear();
+
+ if (data.RandomWarningPos || data.Type == XWarningType.Warning_Multiple)
+ {
+ if (data.RandomWarningPos)
+ {
+ List<GameObject> item = new List<GameObject>();
+ switch (data.Type)
+ {
+ case XWarningType.Warning_All:
+ case XWarningType.Warning_Multiple:
+ {
+ XSkillHit[] hits = GameObject.FindObjectsOfType<XSkillHit>();
+ int n = (data.Type == XWarningType.Warning_All) ? hits.Length : data.MaxRandomTarget;
+
+ for (int i = 0; i < hits.Length; i++)
+ {
+ bool counted = (data.Type == XWarningType.Warning_All) ? true : IsPickedInRange(n, hits.Length - i);
+
+ if (counted)
+ {
+ n--;
+ item.Add(hits[i].gameObject);
+ }
+ }
+ }break;
+ case XWarningType.Warning_Target:
+ {
+ if (_target != null) item.Add(_target);
+ }break;
+ }
+
+ for (int i = 0; i < item.Count; i++)
+ {
+ for (int n = 0; n < data.PosRandomCount; n++)
+ {
+ int d = XCommon.singleton.RandomInt(0, 360);
+ float r = XCommon.singleton.RandomFloat(0, data.PosRandomRange);
+
+ Vector3 v = r * XCommon.singleton.HorizontalRotateVetor3(Vector3.forward, d);
+
+ if (!string.IsNullOrEmpty(data.Fx))
+ {
+ XFxMgr.singleton.CreateAndPlay(
+ data.Fx,
+ item[i].transform,
+ new Vector3(v.x, 0.05f - item[i].transform.position.y, v.z),
+ data.Scale * Vector3.one,
+ 1,
+ false,
+ data.FxDuration);
+ }
+
+ WarningPosAt[data.Index].Add(item[i].transform.position + v);
+ }
+ }
+ }
+ else if(data.Type == XWarningType.Warning_Multiple)
+ {
+ XSkillHit[] hits = GameObject.FindObjectsOfType<XSkillHit>();
+ int n = data.MaxRandomTarget;
+
+ for (int i = 0; i < hits.Length; i++)
+ {
+ if (IsPickedInRange(n, hits.Length - i))
+ {
+ n--;
+
+ if (!string.IsNullOrEmpty(data.Fx))
+ {
+ XFxMgr.singleton.CreateAndPlay(
+ data.Fx,
+ hits[i].transform,
+ new Vector3(0, 0.05f - hits[i].transform.position.y, 0),
+ data.Scale * Vector3.one,
+ 1,
+ false,
+ data.FxDuration);
+ }
+
+ WarningPosAt[data.Index].Add(hits[i].transform.position);
+ }
+ }
+ }
+ }
+ else
+ {
+ switch (data.Type)
+ {
+ case XWarningType.Warning_None:
+ {
+ Vector3 offset = transform.rotation * new Vector3(data.OffsetX, data.OffsetY, data.OffsetZ);
+
+ XFxMgr.singleton.CreateAndPlay(
+ data.Fx,
+ transform,
+ offset,
+ data.Scale * Vector3.one,
+ 1,
+ false,
+ data.FxDuration);
+
+ WarningPosAt[data.Index].Add(transform.position + offset);
+ }break;
+ case XWarningType.Warning_Target:
+ {
+ if (_target != null)
+ {
+ if (!string.IsNullOrEmpty(data.Fx))
+ {
+ XFxMgr.singleton.CreateAndPlay(
+ data.Fx,
+ _target.transform,
+ new Vector3(0, 0.05f - _target.transform.position.y, 0),
+ data.Scale * Vector3.one,
+ 1,
+ false,
+ data.FxDuration);
+ }
+
+ WarningPosAt[data.Index].Add(_target.transform.position);
+ }
+ else
+ {
+ Vector3 offset = transform.rotation * new Vector3(data.OffsetX, data.OffsetY, data.OffsetZ);
+
+ XFxMgr.singleton.CreateAndPlay(
+ data.Fx,
+ transform,
+ offset,
+ data.Scale * Vector3.one,
+ 1,
+ false,
+ data.FxDuration);
+
+ WarningPosAt[data.Index].Add(transform.position + offset);
+ }
+ }break;
+ case XWarningType.Warning_All:
+ {
+ XSkillHit[] hits = GameObject.FindObjectsOfType<XSkillHit>();
+
+ for (int i = 0; i < hits.Length; i++)
+ {
+ if (!string.IsNullOrEmpty(data.Fx))
+ {
+ XFxMgr.singleton.CreateAndPlay(
+ data.Fx,
+ hits[i].transform,
+ new Vector3(0, 0.05f - hits[i].transform.position.y, 0),
+ data.Scale * Vector3.one,
+ 1,
+ false,
+ data.FxDuration);
+ }
+
+ WarningPosAt[data.Index].Add(hits[i].transform.position);
+ }
+ }break;
+ }
+ }
+ }
+
+ private void Fx(object param)
+ {
+ XFxData data = param as XFxData;
+
+ if (data.Shield) return;
+
+ Transform trans = transform;
+ Vector3 offset = new Vector3(data.OffsetX, data.OffsetY, data.OffsetZ);
+
+ XFx fx = XFxMgr.singleton.CreateFx(data.Fx);
+ fx.DelayDestroy = data.Destroy_Delay;
+
+ if (data.StickToGround)
+ {
+ switch (data.Type)
+ {
+ case SkillFxType.FirerBased:
+ {
+
+ }break;
+ case SkillFxType.TargetBased:
+ {
+ if (_current.NeedTarget && _target != null)
+ {
+ trans = _target.transform;
+ offset = new Vector3(data.Target_OffsetX, data.Target_OffsetY, data.Target_OffsetZ);
+ }
+ }break;
+ }
+
+ Vector3 pos = trans.position + trans.rotation * offset;
+ pos.y = 0;
+
+ fx.Play(pos, Quaternion.identity, new Vector3(data.ScaleX, data.ScaleY, data.ScaleZ));
+ }
+ else
+ {
+ switch (data.Type)
+ {
+ case SkillFxType.FirerBased:
+ {
+ if (data.Bone != null && data.Bone.Length > 0)
+ {
+ Transform attachPoint = trans.Find(data.Bone);
+ if (attachPoint != null)
+ {
+ trans = attachPoint;
+ }
+ else
+ {
+ int index = data.Bone.LastIndexOf("/");
+ if (index >= 0)
+ {
+ string bone = data.Bone.Substring(index + 1);
+ attachPoint = trans.Find(bone);
+ if (attachPoint != null)
+ {
+ trans = attachPoint;
+ }
+ }
+ }
+ }
+ }break;
+ case SkillFxType.TargetBased:
+ {
+ if (_current.NeedTarget && _target != null)
+ {
+ trans = _target.transform;
+ offset = new Vector3(data.Target_OffsetX, data.Target_OffsetY, data.Target_OffsetZ);
+ }
+ }break;
+ }
+
+ fx.Play(trans, offset, new Vector3(data.ScaleX, data.ScaleY, data.ScaleZ), 1, data.Follow);
+ }
+
+ if (data.Combined)
+ {
+ if (data.End > 0)
+ AddedCombinedToken(XTimerMgr.singleton.SetTimer(data.End - data.At, KillFx, fx));
+ _outer_fx.Add(fx);
+ }
+ else
+ {
+ if (data.End > 0)
+ AddedTimerToken(XTimerMgr.singleton.SetTimer(data.End - data.At, KillFx, fx), false);
+ _fx.Add(fx);
+ }
+ }
+
+ private void AddedTimerToken(uint token, bool logical)
+ {
+ if(logical)
+ _logicalToken.Add(token);
+ else
+ _presentToken.Add(token);
+ }
+
+ private void AddedCombinedToken(uint token)
+ {
+ _combinedToken.Add(token);
+ }
+
+ private void AddChild(Transform parent, GameObject child)
+ {
+ child.transform.parent = parent;
+ child.transform.localPosition = Vector3.zero;
+ child.transform.localRotation = Quaternion.identity;
+ child.transform.localScale = Vector3.one;
+ }
+
+ private void Audio(object param)
+ {
+ XAudioData data = param as XAudioData;
+
+ //FMOD_StudioSystem.instance.PlayOneShot("event:/" + data.Clip, transform.position);
+
+ if (_emitter == null)
+ _emitter = gameObject.AddComponent<XFmod>();
+
+ _emitter.StartEvent("event:/" + data.Clip, data.Channel);
+ }
+
+ private AudioSource GetAudioSourceByChannel(AudioChannel channel)
+ {
+ switch (channel)
+ {
+ case AudioChannel.Action:
+ {
+ if (_audio_action == null)
+ _audio_action = gameObject.AddComponent<AudioSource>();
+
+ return _audio_action;
+ }
+ case AudioChannel.Motion:
+ {
+ if (_audio_motion == null)
+ _audio_motion = gameObject.AddComponent<AudioSource>();
+
+ return _audio_motion;
+ }
+ case AudioChannel.Skill:
+ {
+ if (_audio_skill == null)
+ _audio_skill = gameObject.AddComponent<AudioSource>();
+
+ return _audio_skill;
+ }
+ case AudioChannel.Behit:
+ {
+ if (_audio_behit == null)
+ _audio_behit = gameObject.AddComponent<AudioSource>();
+
+ return _audio_behit;
+ }
+ }
+
+ return _audio_action;
+ }
+
+ private void Manipulate(object param)
+ {
+ XManipulationData data = param as XManipulationData;
+
+ if (_manipulate == null) _manipulate = new XSkillManipulate(this);
+
+ long token = XCommon.singleton.UniqueToken;
+ _manipulate.Add(token, data);
+ AddedTimerToken(XTimerMgr.singleton.SetTimer(data.End - data.At, KillManipulate, token), true);
+ }
+
+ private void KillManipulate(object param)
+ {
+ _manipulate.Remove((long)param);
+ }
+
+ private void Shake(object param)
+ {
+ XCameraEffectData data = param as XCameraEffectData;
+
+ _xcamera_effect = new XCameraShake(gameObject, _camera.UnityCamera);
+
+ _xcamera_effect.OnShake(
+ data.Time,
+ data.FovAmp,
+ data.AmplitudeX,
+ data.AmplitudeY,
+ data.AmplitudeZ,
+ data.Frequency,
+ data.Coordinate,
+ data.ShakeX,
+ data.ShakeY,
+ data.ShakeZ,
+ data.Random);
+ }
+
+ private void Mob(object param)
+ {
+ XMobUnitData mob = param as XMobUnitData;
+
+ uint id = XStatisticsLibrary.AssociatedData((uint)mob.TemplateID).PresentID;
+ XEntityPresentation.RowData data = XAnimationLibrary.AssociatedAnimations(id);
+
+ GameObject mob_unit = GameObject.Instantiate(Resources.Load("Prefabs/" + data.Prefab)) as GameObject;
+
+ Vector3 offset = transform.rotation * new Vector3(mob.Offset_At_X, mob.Offset_At_Y, mob.Offset_At_Z);
+ Vector3 pos = transform.position + offset;
+
+ mob_unit.transform.position = pos;
+ mob_unit.transform.forward = transform.forward;
+
+ if (mob.LifewithinSkill) mob_unit.tag = "Finish";
+
+ _mob_unit.Add(mob_unit);
+ }
+
+ private void CameraMotion(object param)
+ {
+ XCameraMotionData data = param as XCameraMotionData;
+
+ _camera.Effect(data, _current.TypeToken != 2);
+ }
+
+ private void CameraPostEffect(object param)
+ {
+ XCameraPostEffectData data = param as XCameraPostEffectData;
+
+ Behaviour o = _camera.UnityCamera.GetComponent(data.Effect) as Behaviour;
+ if (o != null) o.enabled = true;
+
+ AddedTimerToken(XTimerMgr.singleton.SetTimer(_current.CameraPostEffect.End - _current.CameraPostEffect.At, CameraPostEffectEnd, o), false);
+ }
+
+ private void CameraPostEffectEnd(object param)
+ {
+ Behaviour o = param as Behaviour;
+ if (o != null) o.enabled = false;
+ }
+
+ private bool CanAct(Vector3 dir)
+ {
+ bool can = false;
+ float now = Time.time - _fire_time;
+
+ XLogicalData logic = (SkillData.TypeToken == 3) ? SkillData.Logical : _current.Logical;
+
+ can = true;
+
+ if (XCommon.singleton.IsLess(now, logic.Not_Move_End) &&
+ XCommon.singleton.IsGreater(now, logic.Not_Move_At))
+ {
+ can = false;
+ }
+
+ if (can)
+ StopFire();
+ else
+ {
+ if (XCommon.singleton.IsLess(now, logic.Rotate_End) &&
+ XCommon.singleton.IsGreater(now, logic.Rotate_At))
+ {
+ //perform rotate
+ PrepareRotation(XCommon.singleton.Horizontal(dir), logic.Rotate_Speed > 0 ? logic.Rotate_Speed : _xConfigData.RotateSpeed);
+ }
+ }
+
+ return can;
+ }
+
+ //can replace by other skill
+ private bool CanReplacedBy(XSkillData skill)
+ {
+ /*
+ * Main skill can always be act
+ */
+ bool cancel = (_xOuterData.Logical.CanReplacedby & (1 << skill.TypeToken)) != 0;
+
+ if (!cancel)
+ {
+ cancel = XCommon.singleton.IsGreater(_delta, _xOuterData.Logical.CanCancelAt);
+ }
+
+ return cancel;
+ }
+
+ private void Combined(object param)
+ {
+ int i = (int)param;
+
+ if (i < _xOuterData.Combined.Count && _xOuterData.Combined[i].Name != null && _xOuterData.Combined[i].Name.Length > 0)
+ {
+ _combined_id = i;
+
+ if (_combined_id > 0)
+ StopFire(false);
+ else
+ MainCoreExecute();
+
+ _trigger = XSkillData.Combined_Command[_combined_id];
+
+ _current = _combinedlist[_combined_id];
+
+ _state = DummyState.Fire;
+ _fire_time = Time.time;
+ if (_ator != null)
+ _ator.speed = 0;
+
+ _time_offset = _xOuterData.Combined[_combined_id].At / _combinedlist[i].Time;
+ }
+ else
+ {
+ StopFire();
+ }
+ }
+
+ private void Ja(object param)
+ {
+ if (!EditorData.XAutoJA) return;
+
+ int i = (int)param;
+
+ float swype = XGesture.singleton.LastSwypeAt;
+ float trigger_at = swype - _fire_time - Time.deltaTime;
+
+ XJAData jd = _current.Ja[_jaCount];
+
+ if (!XCommon.singleton.IsEqual(swype, _last_swype_time) &&
+ XCommon.singleton.IsLess(trigger_at, jd.End) &&
+ XCommon.singleton.IsGreater(trigger_at, jd.At))
+ {
+ if (_xOuterData.Ja[i].Name != null && _xOuterData.Ja[i].Name.Length > 0)
+ {
+ StopFire();
+ _trigger = XSkillData.JA_Command[_xDataExtra.JaEx[i].Ja.SkillPosition];
+
+ _current = _xDataExtra.JaEx[i].Ja;
+
+ _state = DummyState.Fire;
+ _fire_time = Time.time;
+ _delta = 0;
+ if (_ator != null)
+ _ator.speed = 0;
+ }
+ }
+ else if (_xOuterData.Ja[i].Next_Name != null && _xOuterData.Ja[i].Next_Name.Length > 0)
+ {
+ StopFire();
+ _trigger = XSkillData.JA_Command[_xDataExtra.JaEx[i].Next.SkillPosition];
+
+ _current = _xDataExtra.JaEx[i].Next;
+
+ _state = DummyState.Fire;
+ _fire_time = Time.time;
+ _delta = 0;
+ if (_ator != null)
+ _ator.speed = 0;
+ }
+
+ _last_swype_time = swype;
+ _jaCount++;
+ }
+
+ private void Project(XResultData param, int additionalAngle = 0)
+ {
+ if (param.Attack_All)
+ {
+ XSkillHit[] hits = GameObject.FindObjectsOfType<XSkillHit>();
+
+ for (int i = 0; i < hits.Length; i++)
+ {
+ XBulletMgr.singleton.ShootBullet(GenerateBullet(param, hits[i].gameObject, additionalAngle));
+ }
+ }
+ else if (param.Warning)
+ {
+ for (int i = 0; i < WarningPosAt[param.Warning_Idx].Count; i++)
+ {
+ XBulletMgr.singleton.ShootBullet(GenerateBullet(param, null, additionalAngle, i));
+ }
+ }
+ else
+ XBulletMgr.singleton.ShootBullet(GenerateBullet(param, _target, additionalAngle));
+ }
+
+ private XBullet GenerateBullet(XResultData data, GameObject target, int additionalAngle, int wid = -1)
+ {
+ return new XBullet(new XBulletData(
+ this,
+ _current,
+ target,
+ data.Index,
+ data.LongAttackData.FireAngle + additionalAngle,
+ wid));
+ }
+
+ private void FocusTarget()
+ {
+ XSkillHit hit = GameObject.FindObjectOfType<XSkillHit>();
+ _target = (_xOuterData.NeedTarget && hit != null) ? hit.gameObject : null;
+
+ if (_target != null && IsInAttckField(_xOuterData, transform.position, transform.forward, _target))
+ {
+ PrepareRotation(XCommon.singleton.Horizontal(_target.transform.position - transform.position), _xConfigData.RotateSpeed);
+ }
+ }
+
+ private void KillFx(object o)
+ {
+ XFx fx = o as XFx;
+
+ _fx.Remove(fx);
+ _outer_fx.Remove(fx);
+
+ XFxMgr.singleton.DestroyFx(fx, false);
+ }
+
+ private bool IsInField(XSkillData data, int triggerTime, Vector3 pos, Vector3 forward, Vector3 target, float angle, float distance)
+ {
+ bool log = true;
+ if (data.Warning != null && data.Warning.Count > 0)
+ {
+ for (int i = 0; i < data.Warning.Count; i++)
+ {
+ if (data.Warning[i].RandomWarningPos || data.Warning[i].Type == XWarningType.Warning_Multiple)
+ {
+ log = false; break;
+ }
+ }
+ }
+
+ if (data.Result[triggerTime].Sector_Type)
+ {
+ if (!(XCommon.singleton.IsEqualGreater(distance, data.Result[triggerTime].Low_Range) &&
+ XCommon.singleton.IsLess(distance, data.Result[triggerTime].Range) &&
+ angle <= data.Result[triggerTime].Scope * 0.5f))
+ {
+ if (log)
+ {
+ Debug.Log("-----------------------------------");
+ Debug.Log("At " + triggerTime + " Hit missing: distance is " + distance.ToString("F3") + " ( >= " + data.Result[triggerTime].Low_Range.ToString("F3") + ")");
+ Debug.Log("At " + triggerTime + " Hit missing: distance is " + distance.ToString("F3") + " ( < " + data.Result[triggerTime].Range.ToString("F3") + ")");
+ Debug.Log("At " + triggerTime + " Hit missing: dir is " + angle.ToString("F3") + " ( < " + (data.Result[triggerTime].Scope * 0.5f).ToString("F3") + ")");
+ }
+
+ return false;
+ }
+ }
+ else
+ {
+ if (!IsInAttackRect(target, pos, forward, data.Result[triggerTime].Range, data.Result[triggerTime].Scope, data.Result[triggerTime].Rect_HalfEffect, data.Result[triggerTime].None_Sector_Angle_Shift))
+ {
+ float d = data.Result[triggerTime].Range;
+ float w = data.Result[triggerTime].Scope;
+
+ Vector3[] vecs = new Vector3[4];
+ vecs[0] = new Vector3(-w / 2.0f, 0, data.Result[triggerTime].Rect_HalfEffect ? 0 : (-d / 2.0f));
+ vecs[1] = new Vector3(-w / 2.0f, 0, d / 2.0f);
+ vecs[2] = new Vector3(w / 2.0f, 0, d / 2.0f);
+ vecs[3] = new Vector3(w / 2.0f, 0, data.Result[triggerTime].Rect_HalfEffect ? 0 : (-d / 2.0f));
+
+ if (log)
+ {
+ Debug.Log("-----------------------------------");
+ Debug.Log("Not in rect " + vecs[0] + " " + vecs[1] + " " + vecs[2] + " " + vecs[3]);
+ }
+
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private bool IsInAttckField(XSkillData data, Vector3 pos, Vector3 forward, GameObject target)
+ {
+ forward = XCommon.singleton.HorizontalRotateVetor3(forward, data.Cast_Scope_Shift);
+ Vector3 targetPos = target.transform.position;
+
+ if (data.Cast_Range_Rect)
+ {
+ pos.x += data.Cast_Offset_X;
+ pos.z += data.Cast_Offset_Z;
+
+ return IsInAttackRect(targetPos, pos, forward, data.Cast_Range_Upper, data.Cast_Scope, false, 0);
+ }
+ else
+ {
+ Vector3 dir = targetPos - pos; dir.y = 0;
+ float distance = dir.magnitude;
+
+ //normalize
+ dir.Normalize();
+
+ float angle = (distance == 0) ? 0 : Vector3.Angle(forward, dir);
+
+ if (XCommon.singleton.IsEqualLess(distance, data.Cast_Range_Upper) &&
+ XCommon.singleton.IsEqualGreater(distance, data.Cast_Range_Lower) &&
+ angle <= data.Cast_Scope * 0.5f)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ private bool IsInAttackRect(Vector3 target, Vector3 anchor, Vector3 forward, float d, float w, bool half, float shift)
+ {
+ Quaternion rotation = XCommon.singleton.VectorToQuaternion(XCommon.singleton.HorizontalRotateVetor3(forward, shift));
+
+ Rect rect = new Rect();
+
+ rect.xMin = -w / 2.0f;
+ rect.xMax = w / 2.0f;
+ rect.yMin = half ? 0 : (-d / 2.0f);
+ rect.yMax = d / 2.0f;
+
+ return XCommon.singleton.IsInRect(target - anchor, rect, Vector3.zero, rotation);
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHoster.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHoster.cs.meta
new file mode 100644
index 00000000..a7ce52ba
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillHoster.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3295e2c2ba4c26e4785b935b72855f98
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillManipulate.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillManipulate.cs
new file mode 100644
index 00000000..1ff6470e
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillManipulate.cs
@@ -0,0 +1,65 @@
+#if UNITY_EDITOR
+using System;
+using UnityEngine;
+using XUtliPoolLib;
+using System.Collections.Generic;
+
+namespace XEditor
+{
+ class XSkillManipulate
+ {
+ private XSkillHoster _hoster = null;
+
+ private Dictionary<long, XManipulationData> _item = new Dictionary<long, XManipulationData>();
+ public Dictionary<long, XManipulationData> Set { get { return _item; } }
+
+ public XSkillManipulate(XSkillHoster hoster)
+ {
+ _hoster = hoster;
+ }
+
+ public void Add(long token, XManipulationData data)
+ {
+ if (!_item.ContainsKey(token))
+ {
+ _item.Add(token, data);
+ }
+ }
+
+ public void Remove(long token)
+ {
+ if (token == 0) _item.Clear();
+ else
+ {
+ _item.Remove(token);
+ }
+ }
+
+ public void Update(float deltaTime)
+ {
+ XSkillHit[] hits = GameObject.FindObjectsOfType<XSkillHit>();
+
+ foreach (XManipulationData data in _item.Values)
+ {
+ Vector3 center = _hoster.transform.position + _hoster.transform.rotation * new Vector3(data.OffsetX, 0, data.OffsetZ);
+
+ foreach (XSkillHit hit in hits)
+ {
+ Vector3 gap = center - hit.transform.position; gap.y = 0;
+ float dis = gap.magnitude;
+
+ if (dis < data.Radius && (dis == 0 || Vector3.Angle(-gap, _hoster.transform.forward) <= data.Degree * 0.5f))
+ {
+ float len = data.Force * deltaTime;
+
+ Vector3 dir = gap.normalized;
+ Vector3 move = dir * Mathf.Min(dis, len);
+
+ hit.transform.Translate(move, Space.World);
+ }
+ }
+ }
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillManipulate.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillManipulate.cs.meta
new file mode 100644
index 00000000..767c562c
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XSkillManipulate.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b67fb09ff0ab7ba4aa099519d59dbfcc
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XTouch.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XTouch.cs
new file mode 100644
index 00000000..6924e395
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XTouch.cs
@@ -0,0 +1,130 @@
+#if UNITY_EDITOR
+using System;
+using System.Collections.Generic;
+using XUtliPoolLib;
+using UnityEngine;
+
+namespace XEditor
+{
+ internal class XTouch : XSingleton<XTouch>
+ {
+ private bool _bEditorMode = false;
+ private bool _bHasTouch = false;
+ private Vector3 _lastMousePosition = Vector3.zero;
+
+ private XTouchItem _touch = new XTouchItem();
+
+ public XTouch()
+ {
+ _bEditorMode = (Application.platform == RuntimePlatform.WindowsEditor ||
+ Application.platform == RuntimePlatform.OSXEditor);
+ }
+
+ public XTouchItem GetTouch()
+ {
+ if (_bHasTouch)
+ return _touch;
+ else
+ return null;
+ }
+
+ public void Update()
+ {
+ _bHasTouch = false;
+
+ if (_bEditorMode)
+ {
+ if (Input.GetMouseButton(0))
+ {
+ _touch.faketouch.fingerId = 10;
+ _touch.faketouch.position = Input.mousePosition;
+ _touch.faketouch.deltaTime = Time.deltaTime;
+ _touch.faketouch.deltaPosition = Input.mousePosition - _lastMousePosition;
+ _touch.faketouch.phase = (Input.GetMouseButtonDown(0) ? TouchPhase.Began :
+ (_touch.faketouch.deltaPosition.sqrMagnitude > 1.0f ? TouchPhase.Moved : TouchPhase.Stationary));
+ _touch.faketouch.tapCount = 1;
+
+ _touch.Fake = true;
+
+ HandleTouch();
+ }
+ else if (Input.GetMouseButtonUp(0))
+ {
+ _touch.faketouch.fingerId = 10;
+ _touch.faketouch.position = Input.mousePosition;
+ _touch.faketouch.deltaTime = Time.deltaTime;
+ _touch.faketouch.deltaPosition = Input.mousePosition - _lastMousePosition;
+ _touch.faketouch.phase = TouchPhase.Ended;
+ _touch.faketouch.tapCount = 1;
+
+ _touch.Fake = true;
+
+ HandleTouch();
+ }
+ }
+ else
+ {
+ if (Input.touchCount > 0)
+ {
+ _touch.Fake = false;
+ _touch.touch = Input.GetTouch(0);
+
+ HandleTouch();
+ }
+ }
+ }
+
+ private void HandleTouch()
+ {
+ _bHasTouch = true;
+ }
+ }
+
+ internal class XTouchItem
+ {
+ public bool Fake { get; set; }
+ public Touch touch;
+ public XFakeTouch faketouch = new XFakeTouch();
+
+ public Vector2 DeltaPosition
+ {
+ get { return Fake ? faketouch.deltaPosition : touch.deltaPosition; }
+ }
+ public float DeltaTime
+ {
+ get { return Fake ? faketouch.deltaTime : touch.deltaTime; }
+ }
+ public int FingerId
+ {
+ get { return Fake ? faketouch.fingerId : touch.fingerId; }
+ }
+ public TouchPhase Phase
+ {
+ get { return Fake ? faketouch.phase : touch.phase; }
+ }
+ public Vector2 Position
+ {
+ get { return Fake ? faketouch.position : touch.position; }
+ }
+ public Vector2 RawPosition
+ {
+ get { return Fake ? faketouch.rawPosition : touch.rawPosition; }
+ }
+ public int TapCount
+ {
+ get { return Fake ? faketouch.tapCount : touch.tapCount; }
+ }
+ }
+
+ internal struct XFakeTouch
+ {
+ public Vector2 deltaPosition { get; set; }
+ public float deltaTime { get; set; }
+ public int fingerId { get; set; }
+ public TouchPhase phase { get; set; }
+ public Vector2 position { get; set; }
+ public Vector2 rawPosition { get; set; }
+ public int tapCount { get; set; }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XTouch.cs.meta b/Client/Assets/Scripts/XEditor/XSkillEditor/XTouch.cs.meta
new file mode 100644
index 00000000..38955346
--- /dev/null
+++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XTouch.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 9b9ac90abfdf5cc488c6b7074b6ab4f6
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData: