diff options
author | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
commit | 22891bf59032ba88262824255a706d652031384b (patch) | |
tree | 7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/Scripts/Unit/UnitDetail.cs | |
parent | 8b04ea73e540067f83870b61d89db4868fea5e8a (diff) |
* move folder
Diffstat (limited to 'Assets/Scripts/Unit/UnitDetail.cs')
-rw-r--r-- | Assets/Scripts/Unit/UnitDetail.cs | 218 |
1 files changed, 0 insertions, 218 deletions
diff --git a/Assets/Scripts/Unit/UnitDetail.cs b/Assets/Scripts/Unit/UnitDetail.cs deleted file mode 100644 index c57b87b5..00000000 --- a/Assets/Scripts/Unit/UnitDetail.cs +++ /dev/null @@ -1,218 +0,0 @@ -using System; -using UnityEngine.Serialization; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public enum EUnitBone -{ - Hips = 0, // 盆骨 - Spine , // 脊柱 - Chest , // 胸腔 - UpperChest , // - Neck , - Head , - LEye , - REye , - Jaw , - - LShoulder = 20, - LUpperArm, - LLowerArm, - LHand, - LFinger00, - LFinger01, - LFinger02, - LFinger10, - LFinger11, - LFinger12, - LFinger20, - LFinger21, - LFinger22, - LFinger30, - LFinger31, - LFinger32, - LFinger40, - LFinger41, - LFinger42, - - RShoulder = 40, - RUpperArm, - RLowerArm, - RHand, - RFinger00, - RFinger01, - RFinger02, - RFinger10, - RFinger11, - RFinger12, - RFinger20, - RFinger21, - RFinger22, - RFinger30, - RFinger31, - RFinger32, - RFinger40, - RFinger41, - RFinger42, - - LUpperLeg = 60, // 大腿 - LLowerLeg, // 小腿肚 - LFoot, // 左脚 - LToes, // 脚趾 - //LToe0, // 脚趾0 - //LToe1, // 脚趾1 - //LToe2, // 脚趾2 - //LToe3, // 脚趾3 - //LToe4, // 脚趾4 - - RUpperLeg = 80, // 大腿 - RLowerLeg, // 小腿肚 - RFoot, // 左脚 - RToes, // 脚趾 - //RToe0, // 脚趾0 - //RToe1, // 脚趾1 - //RToe2, // 脚趾2 - //RToe3, // 脚趾3 - //RToe4, // 脚趾4 - -} - -[Serializable] -public class UnitBoneDictionary : SerializableDictionary<EUnitBone, Transform> { } - -public enum EUnitReferencePoint
-{
- None = 0,
-
- Gunpoint = 1, // 枪口
- Gunpoint2, // 枪口
-
- SwordTop = 20, // 剑尖端
- SwordBottom, // 剑底端
-
- HitpointHead = 40,
- HitpointHeadFront,
- HitpointHeadBack,
- HitpointNeck,
- HitpointUpperBody,
- HitpointUpperBodyFront,
- HitpointUpperBodyBack,
- HitpointLowerBody,
- HitpointLowerBodyFront,
- HitpointLowerBodyBack,
-
- GrabpointChest = 60, // 被抓取的时候的挂点
- GrabpointHead,
- GrabpointLeg,
-
-} - -[Serializable] -public class UnitReferencePointDictionary : SerializableDictionary<EUnitReferencePoint, Transform> { } - -public enum EBodyPart
-{
- Body = 0, // main body
- Sword = 1,
-} - -[Serializable] -public class BodyPartRenderer
-{
- [SerializeField] public EBodyPart tag;
- [SerializeField] public Renderer renderer;
-} - -public interface IBodyRendererAgent
-{
- BodyPartRenderer mainRenderer { get; }
- BodyPartRenderer[] renderers { get; }
-} - -public interface IBodyJointAgent
-{
- UnitBoneDictionary bones { get; }
- UnitReferencePointDictionary referencePoints { get; }
-} - -// 角色的prefab附加数据 -// * afterimage的prefab -// * 骨骼映射 -// * 武器 -[DisallowMultipleComponent] -public class UnitDetail : MonoBehaviour, IBodyRendererAgent, IBodyJointAgent -{ - public bool showGizmos;
-
- [FormerlySerializedAs("root")] - public Transform rootBone; - - [Tooltip("残影用的prefab")] - public string afterImageAvatarPath;
-
- [Tooltip("Snapshot用的prefab")] - public string snapshotAvatarPath;
-
- UnitBoneDictionary IBodyJointAgent.bones { get { return m_Bones; } }
- [FormerlySerializedAs("bones")] - public UnitBoneDictionary m_Bones;
-
- UnitReferencePointDictionary IBodyJointAgent.referencePoints { get { return m_ReferencePoints; } }
- [FormerlySerializedAs("referencePoints")] - public UnitReferencePointDictionary m_ReferencePoints;
-
- public float snapshotBound;
-
- BodyPartRenderer IBodyRendererAgent.mainRenderer { get { return m_MainRenderer; } }
- [SerializeField] private BodyPartRenderer m_MainRenderer;
- BodyPartRenderer[] IBodyRendererAgent.renderers { get { return m_Renderers; } }
- [SerializeField] private BodyPartRenderer[] m_Renderers;
-
- public Vector3 center
- {
- get
- {
- if (m_MainRenderer == null || m_MainRenderer.renderer == null)
- return Vector3.zero ;
- return m_MainRenderer.renderer.bounds.center;
- }
- }
-
- public UnitDetail() - {
- m_Bones = new UnitBoneDictionary(); - foreach(EUnitBone e in Enum.GetValues(typeof(EUnitBone))) - {
- m_Bones.Add(e, null); - } - } - - public Transform GetBone(EUnitBone bone) - { - if (m_Bones.ContainsKey(bone)) - return m_Bones[bone]; - return null; - } - - public bool HasBone(EUnitBone bone) - { - return m_Bones.ContainsKey(bone); - } - - private void OnDrawGizmos()
- {
- if (!showGizmos)
- return;
- Gizmos.DrawWireCube(center, new Vector3(snapshotBound, snapshotBound, 0));
- } - - IEnumerator GetRenderers()
- {
- for(int i = 0; i < m_Renderers.Length; ++i)
- {
- yield return m_Renderers[i].renderer;
- }
- } - -}
\ No newline at end of file |