diff options
author | chai <chaifix@163.com> | 2021-09-16 09:52:33 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-09-16 09:52:33 +0800 |
commit | 8b65edb43be0945203633b33d7a62c81ab3f05ce (patch) | |
tree | bb5186baf27e58ca96389843907f9906380fd8e0 /Assets/Scripts/Unit/UnitDetail.cs | |
parent | 28b89971f0d3fd246443450c87f33996716facb3 (diff) |
+unit effect
Diffstat (limited to 'Assets/Scripts/Unit/UnitDetail.cs')
-rw-r--r-- | Assets/Scripts/Unit/UnitDetail.cs | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/Assets/Scripts/Unit/UnitDetail.cs b/Assets/Scripts/Unit/UnitDetail.cs index bab954c4..03d26fdd 100644 --- a/Assets/Scripts/Unit/UnitDetail.cs +++ b/Assets/Scripts/Unit/UnitDetail.cs @@ -100,6 +100,11 @@ public enum EUnitReferencePoint HitpointLowerBody,
HitpointLowerBodyFront,
HitpointLowerBodyBack,
+
+ GrabpointChest = 60, // 被抓取的时候的挂点
+ GrabpointHead,
+ GrabpointLeg,
+
} [Serializable] @@ -112,6 +117,8 @@ public class UnitReferencePointDictionary : SerializableDictionary<EUnitReferenc [DisallowMultipleComponent] public class UnitDetail : MonoBehaviour { + public bool showGizmos; + [Tooltip("残影用的prefab")] public string afterImageAvatarPath; @@ -119,8 +126,30 @@ public class UnitDetail : MonoBehaviour public UnitReferencePointDictionary referencePoints;
- //[ExecuteInEditMode]
- public UnitDetail() + //public Vector2 snapshotBound;
+ public float snapshotBound;
+
+ private SkinnedMeshRenderer m_meshRenderer;
+ public SkinnedMeshRenderer meshRenderer
+ {
+ get
+ {
+ if (!m_meshRenderer)
+ m_meshRenderer = this.gameObject.GetComponentInChildren<SkinnedMeshRenderer>();
+ return m_meshRenderer;
+ }
+ }
+
+
+ public Vector3 center
+ {
+ get
+ {
+ return meshRenderer.bounds.center;
+ }
+ }
+
+ public UnitDetail() { bones = new UnitBoneDictionary(); foreach(EUnitBone e in Enum.GetValues(typeof(EUnitBone))) @@ -141,4 +170,11 @@ public class UnitDetail : MonoBehaviour return bones.ContainsKey(bone); } + private void OnDrawGizmos()
+ {
+ if (!showGizmos)
+ return;
+ Gizmos.DrawWireCube(center, new Vector3(snapshotBound, snapshotBound, 0));
+ } + }
\ No newline at end of file |