summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo01_Z0_3.asset5
-rw-r--r--Assets/Bundle/Unit/PC/Erika/Prefabs/Erika_Robot.prefab74
-rw-r--r--Assets/Scenes/Demo/AnimationEditScene.unity71
-rw-r--r--Assets/Scripts/Unit/Controller/UnitController.cs4
-rw-r--r--Assets/Scripts/Unit/Editor/UnitDictionariesDrawer.cs5
-rw-r--r--Assets/Scripts/Unit/Editor/UnitDictionariesDrawer.cs.meta (renamed from Assets/Scripts/Unit/UnitParts.cs.meta)2
-rw-r--r--Assets/Scripts/Unit/Events/EventEffect.cs6
-rw-r--r--Assets/Scripts/Unit/TimelineEventProxy.cs2
-rw-r--r--Assets/Scripts/Unit/TimelineEventProxy_Handlers.cs15
-rw-r--r--Assets/Scripts/Unit/UnitDetail.cs117
-rw-r--r--Assets/Scripts/Unit/UnitDetail.cs.meta11
-rw-r--r--Assets/Scripts/Unit/UnitParts.cs22
12 files changed, 299 insertions, 35 deletions
diff --git a/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo01_Z0_3.asset b/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo01_Z0_3.asset
index dbef8af6..12f195a1 100644
--- a/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo01_Z0_3.asset
+++ b/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo01_Z0_3.asset
@@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cab6406109041434e890f22d6455172f, type: 3}
- m_Name: Air_Combo01_Z0_3(Clone)
+ m_Name: Air_Combo01_Z0_3
m_EditorClassIdentifier:
animationName: Air_Combo01_Z0_3
animationPath: Assets/Bundle/Unit/PC/Erika/AnimationClip/Air_Combo01_Z0_3.anim
@@ -88,7 +88,8 @@ MonoBehaviour:
effectPath: Assets/Art/Vfx/Sword slash VFX/Prefabs/Sword Slash 6.prefab
attached: 1
attachNode: 0
- bone:
+ bonePath:
+ unitBone: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0}
scale: {x: 0, y: 0, z: 0}
diff --git a/Assets/Bundle/Unit/PC/Erika/Prefabs/Erika_Robot.prefab b/Assets/Bundle/Unit/PC/Erika/Prefabs/Erika_Robot.prefab
index eab46532..982d99cf 100644
--- a/Assets/Bundle/Unit/PC/Erika/Prefabs/Erika_Robot.prefab
+++ b/Assets/Bundle/Unit/PC/Erika/Prefabs/Erika_Robot.prefab
@@ -592,7 +592,7 @@ GameObject:
m_Component:
- component: {fileID: 6930345995811640846}
- component: {fileID: 7023111129766813114}
- - component: {fileID: 1704775273}
+ - component: {fileID: 5512425670061407962}
m_Layer: 0
m_Name: Erika_Robot
m_TagString: Untagged
@@ -636,7 +636,7 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
---- !u!114 &1704775273
+--- !u!114 &5512425670061407962
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@@ -645,10 +645,78 @@ MonoBehaviour:
m_GameObject: {fileID: 6928033330946439154}
m_Enabled: 1
m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: 19d4fad3ce933bf45a32ff4d0d7e328a, type: 3}
+ m_Script: {fileID: 11500000, guid: 75a2e2ebdc58ab940858d821f8a1ffa0, type: 3}
m_Name:
m_EditorClassIdentifier:
afterImageAvatarPath: Assets/Bundle/Unit/PC/Erika/Prefabs/Erika_Robot_AfterImage.prefab
+ bones:
+ m_keys: 0000000001000000020000000300000004000000050000000600000007000000080000001400000015000000160000001700000018000000190000001a0000001b0000001c0000001d0000001e0000001f0000002000000021000000220000002300000024000000250000002600000028000000290000002a0000002b0000002c0000002d0000002e0000002f000000300000003100000032000000330000003400000035000000360000003700000038000000390000003a0000003c0000003d0000003e0000003f0000004000000041000000420000004300000044000000500000005100000052000000530000005400000055000000560000005700000058000000
+ m_values:
+ - {fileID: 6931910881339740176}
+ - {fileID: 6930073807658420724}
+ - {fileID: 6932088213832717862}
+ - {fileID: 0}
+ - {fileID: 6931808467863946034}
+ - {fileID: 6930315471109823840}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 6931732980853886622}
+ - {fileID: 6929954358527148988}
+ - {fileID: 6930274299856541416}
+ - {fileID: 6931767661460636600}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 6930120644517152616}
+ - {fileID: 6931831850464984658}
+ - {fileID: 6930114104734920462}
+ - {fileID: 6930305872343221556}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 6930266010808624108}
+ - {fileID: 6932062504377624008}
+ - {fileID: 6931781989322704274}
+ - {fileID: 6932147230275975732}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 6931862975547679840}
+ - {fileID: 6930399342477815872}
+ - {fileID: 6931776861846272074}
+ - {fileID: 6929941362883253820}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
--- !u!1 &6928056367075676882
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/Scenes/Demo/AnimationEditScene.unity b/Assets/Scenes/Demo/AnimationEditScene.unity
index cf98c85c..47a14f54 100644
--- a/Assets/Scenes/Demo/AnimationEditScene.unity
+++ b/Assets/Scenes/Demo/AnimationEditScene.unity
@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
- m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
+ m_IndirectSpecularColor: {r: 0.18028334, g: 0.22571328, b: 0.3069217, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
@@ -53074,6 +53074,75 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
offset: {x: 0, y: 1.5, z: 0}
+--- !u!1001 &913924205
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ m_TransformParent: {fileID: 0}
+ m_Modifications:
+ - target: {fileID: 6928033330946439154, guid: 0b08ee7afb9df4649b0dd2cd0a3eeac7,
+ type: 3}
+ propertyPath: m_Name
+ value: Erika_Robot
+ objectReference: {fileID: 0}
+ - target: {fileID: 6930345995811640846, guid: 0b08ee7afb9df4649b0dd2cd0a3eeac7,
+ type: 3}
+ propertyPath: m_LocalPosition.x
+ value: 3.54
+ objectReference: {fileID: 0}
+ - target: {fileID: 6930345995811640846, guid: 0b08ee7afb9df4649b0dd2cd0a3eeac7,
+ type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 3.34
+ objectReference: {fileID: 0}
+ - target: {fileID: 6930345995811640846, guid: 0b08ee7afb9df4649b0dd2cd0a3eeac7,
+ type: 3}
+ propertyPath: m_LocalPosition.z
+ value: -12.52
+ objectReference: {fileID: 0}
+ - target: {fileID: 6930345995811640846, guid: 0b08ee7afb9df4649b0dd2cd0a3eeac7,
+ type: 3}
+ propertyPath: m_LocalRotation.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6930345995811640846, guid: 0b08ee7afb9df4649b0dd2cd0a3eeac7,
+ type: 3}
+ propertyPath: m_LocalRotation.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6930345995811640846, guid: 0b08ee7afb9df4649b0dd2cd0a3eeac7,
+ type: 3}
+ propertyPath: m_LocalRotation.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6930345995811640846, guid: 0b08ee7afb9df4649b0dd2cd0a3eeac7,
+ type: 3}
+ propertyPath: m_LocalRotation.w
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 6930345995811640846, guid: 0b08ee7afb9df4649b0dd2cd0a3eeac7,
+ type: 3}
+ propertyPath: m_RootOrder
+ value: 11
+ objectReference: {fileID: 0}
+ - target: {fileID: 6930345995811640846, guid: 0b08ee7afb9df4649b0dd2cd0a3eeac7,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6930345995811640846, guid: 0b08ee7afb9df4649b0dd2cd0a3eeac7,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6930345995811640846, guid: 0b08ee7afb9df4649b0dd2cd0a3eeac7,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: 0b08ee7afb9df4649b0dd2cd0a3eeac7, type: 3}
--- !u!1 &1036440312
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/Scripts/Unit/Controller/UnitController.cs b/Assets/Scripts/Unit/Controller/UnitController.cs
index 384299de..3c09e5e6 100644
--- a/Assets/Scripts/Unit/Controller/UnitController.cs
+++ b/Assets/Scripts/Unit/Controller/UnitController.cs
@@ -39,7 +39,7 @@ public class UnitController : MonoBehaviour/*, Interactable*/
public UnitCollider unitCollider;
- public UnitParts unitParts;
+ public UnitDetail unitDetail;
public GameObject unitObj; // 角色模型
@@ -121,7 +121,7 @@ public class UnitController : MonoBehaviour/*, Interactable*/
unitCollider = gameObject.GetOrAddComponent<UnitCollider>();
unitCollider.Initialize();
- unitParts = gameObject.GetComponentInChildren<UnitParts>();
+ unitDetail = gameObject.GetComponentInChildren<UnitDetail>();
}
public virtual void Update()
diff --git a/Assets/Scripts/Unit/Editor/UnitDictionariesDrawer.cs b/Assets/Scripts/Unit/Editor/UnitDictionariesDrawer.cs
new file mode 100644
index 00000000..d56c9f36
--- /dev/null
+++ b/Assets/Scripts/Unit/Editor/UnitDictionariesDrawer.cs
@@ -0,0 +1,5 @@
+using UnityEditor;
+
+[CustomPropertyDrawer(typeof(UnitBoneDictionary))]
+public class UnitBoneDictionaryDrawer : SerializableDictionaryPropertyDrawer { }
+
diff --git a/Assets/Scripts/Unit/UnitParts.cs.meta b/Assets/Scripts/Unit/Editor/UnitDictionariesDrawer.cs.meta
index c95d5fdb..4a92e024 100644
--- a/Assets/Scripts/Unit/UnitParts.cs.meta
+++ b/Assets/Scripts/Unit/Editor/UnitDictionariesDrawer.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 19d4fad3ce933bf45a32ff4d0d7e328a
+guid: 8850261fe4c29b442a0e3b613e07597e
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/Assets/Scripts/Unit/Events/EventEffect.cs b/Assets/Scripts/Unit/Events/EventEffect.cs
index 347b92f5..1369e7b0 100644
--- a/Assets/Scripts/Unit/Events/EventEffect.cs
+++ b/Assets/Scripts/Unit/Events/EventEffect.cs
@@ -6,6 +6,7 @@ public class EventEffect : AnimationEventBase
{
Unit,
Bone,
+ PresetBone,
}
public override TimelineEventProxy.EEventType type { get { return TimelineEventProxy.EEventType.EventEffect; } }
@@ -21,7 +22,10 @@ public class EventEffect : AnimationEventBase
public EAttachNode attachNode = EAttachNode.Unit;
[When("attachNode", EAttachNode.Bone), Tooltip("Bone path attach to")]
- public string bone;
+ public string bonePath;
+
+ [When("attachNode", EAttachNode.PresetBone), Tooltip("Preset unit bone defined in unit details")]
+ public EUnitBone bone;
[Tooltip("Position offset")]
public Vector3 position;
diff --git a/Assets/Scripts/Unit/TimelineEventProxy.cs b/Assets/Scripts/Unit/TimelineEventProxy.cs
index de6e6b0b..70e454ba 100644
--- a/Assets/Scripts/Unit/TimelineEventProxy.cs
+++ b/Assets/Scripts/Unit/TimelineEventProxy.cs
@@ -81,7 +81,7 @@ public partial class TimelineEventProxy
private Transform m_Root;
- private Transform m_UnitModel; // 模型的Unit,默认是m_Root的第一个子节点
+ private Transform m_UnitModel; // 模型的Unit prefab,默认是m_Root的第一个子节点
public UnitController owner { get; private set; }
diff --git a/Assets/Scripts/Unit/TimelineEventProxy_Handlers.cs b/Assets/Scripts/Unit/TimelineEventProxy_Handlers.cs
index 119cf105..adc4fe3e 100644
--- a/Assets/Scripts/Unit/TimelineEventProxy_Handlers.cs
+++ b/Assets/Scripts/Unit/TimelineEventProxy_Handlers.cs
@@ -41,7 +41,18 @@ public partial class TimelineEventProxy
{
if (m_UnitModel != null)
{
- info.rootTr = m_UnitModel.Find(effect.bone);
+ info.rootTr = m_UnitModel.Find(effect.bonePath);
+ }
+ }
+ else if(effect.attachNode == global::EventEffect.EAttachNode.PresetBone)
+ {
+ if(m_UnitModel != null)
+ {
+ UnitDetail detail = m_UnitModel.GetComponent<UnitDetail>();
+ if(detail)
+ {
+ info.rootTr = detail.GetBone(effect.bone);
+ }
}
}
}
@@ -122,7 +133,7 @@ public partial class TimelineEventProxy
EventMesh_AfterImage afterImage = animEvent as EventMesh_AfterImage;
if (afterImage == null)
return;
- string avatarPath = owner.unitParts.afterImageAvatarPath;
+ string avatarPath = owner.unitDetail.afterImageAvatarPath;
GameObject go = ResourceManager.Instance.LoadAsset<GameObject>(avatarPath);
if (go)
{
diff --git a/Assets/Scripts/Unit/UnitDetail.cs b/Assets/Scripts/Unit/UnitDetail.cs
new file mode 100644
index 00000000..30a98c63
--- /dev/null
+++ b/Assets/Scripts/Unit/UnitDetail.cs
@@ -0,0 +1,117 @@
+using System;
+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> { }
+
+// 角色的prefab附加数据
+// * afterimage的prefab
+// * 骨骼映射
+// * 武器
+[DisallowMultipleComponent]
+public class UnitDetail : MonoBehaviour
+{
+ [Tooltip("残影用的prefab")]
+ public string afterImageAvatarPath;
+
+ public UnitBoneDictionary bones;
+
+ //[ExecuteInEditMode]
+ public UnitDetail()
+ {
+ bones = new UnitBoneDictionary();
+ foreach(EUnitBone e in Enum.GetValues(typeof(EUnitBone)))
+ {
+ bones.Add(e, null);
+ }
+ }
+
+ public Transform GetBone(EUnitBone bone)
+ {
+ if (bones.ContainsKey(bone))
+ return bones[bone];
+ return null;
+ }
+
+ public bool HasBone(EUnitBone bone)
+ {
+ return bones.ContainsKey(bone);
+ }
+
+} \ No newline at end of file
diff --git a/Assets/Scripts/Unit/UnitDetail.cs.meta b/Assets/Scripts/Unit/UnitDetail.cs.meta
new file mode 100644
index 00000000..f004ea18
--- /dev/null
+++ b/Assets/Scripts/Unit/UnitDetail.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 75a2e2ebdc58ab940858d821f8a1ffa0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Unit/UnitParts.cs b/Assets/Scripts/Unit/UnitParts.cs
deleted file mode 100644
index 88c9cb23..00000000
--- a/Assets/Scripts/Unit/UnitParts.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// 部件
-[DisallowMultipleComponent]
-public class UnitParts : MonoBehaviour
-{
- public enum EUnitPart
- {
- Sword = 1,
- Gun = 2,
- LHand = 3,
- RHand = 4,
- }
-
- [Tooltip("残影用的prefab")]
- public string afterImageAvatarPath;
-
-
-
-}