summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2022-06-22 22:50:46 +0800
committerchai <chaifix@163.com>2022-06-22 22:50:46 +0800
commit23d3d8dad9769d78ce5adb4ac9436f3f99a80bca (patch)
treef1fe3e288d8d7f36f65e5331c6f7622528dc8cd9
parent11bd605dadecb7459bc60fcda33e2e7d8275ed5d (diff)
* Unit Action Data
-rw-r--r--Documents/动画相关问题.xlsxbin866163 -> 877122 bytes
-rw-r--r--Erika/Assets/Bundle/Scenes/Demo/AnimationEditScene_Profiles/GameObject Profile.asset2
-rw-r--r--Erika/Assets/Bundle/Unit/PC/Erika/ActionData/ErikaActionData.asset33
-rw-r--r--Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_2.asset2
-rw-r--r--Erika/Assets/Scripts/Test2/TestErika.cs21
-rw-r--r--Erika/Assets/Scripts/Unit/AnimationData.cs5
-rw-r--r--Erika/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs2
-rw-r--r--Erika/Assets/Scripts/Unit/Components/UnitAnimation/UnitAnimation.cs5
-rw-r--r--Erika/Assets/Scripts/Unit/UnitActionData.cs7
9 files changed, 44 insertions, 33 deletions
diff --git a/Documents/动画相关问题.xlsx b/Documents/动画相关问题.xlsx
index 7d89e043..526d3c75 100644
--- a/Documents/动画相关问题.xlsx
+++ b/Documents/动画相关问题.xlsx
Binary files differ
diff --git a/Erika/Assets/Bundle/Scenes/Demo/AnimationEditScene_Profiles/GameObject Profile.asset b/Erika/Assets/Bundle/Scenes/Demo/AnimationEditScene_Profiles/GameObject Profile.asset
index 0b6d5d6b..b6ac72cf 100644
--- a/Erika/Assets/Bundle/Scenes/Demo/AnimationEditScene_Profiles/GameObject Profile.asset
+++ b/Erika/Assets/Bundle/Scenes/Demo/AnimationEditScene_Profiles/GameObject Profile.asset
@@ -34,7 +34,7 @@ MonoBehaviour:
value: 1
intensity:
overrideState: 1
- value: 1
+ value: 3.67
threshold:
overrideState: 1
value: 1
diff --git a/Erika/Assets/Bundle/Unit/PC/Erika/ActionData/ErikaActionData.asset b/Erika/Assets/Bundle/Unit/PC/Erika/ActionData/ErikaActionData.asset
index 0a2d8ca8..2e3fdcaa 100644
--- a/Erika/Assets/Bundle/Unit/PC/Erika/ActionData/ErikaActionData.asset
+++ b/Erika/Assets/Bundle/Unit/PC/Erika/ActionData/ErikaActionData.asset
@@ -12,6 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 34c4f0be042b58840bbd5f39068e5007, type: 3}
m_Name: ErikaActionData
m_EditorClassIdentifier:
+ referenceController: {fileID: 9100000, guid: dbcf42e4fb8a6ad4488eb7d2941acc31, type: 2}
actions:
m_keys:
- Idle
@@ -31,19 +32,19 @@ MonoBehaviour:
- Attack2
- Attack3
m_values:
- - {fileID: 7400000, guid: 599f2b26128dfd742b4aefbc285c4d3e, type: 2}
- - {fileID: 7400000, guid: 95c80bbb74677844aad0f268349b4743, type: 2}
- - {fileID: 7400000, guid: 30ab9f767efd0ad4bbb7f1a3f0103903, type: 2}
- - {fileID: 7400000, guid: 26bb0d2d4098c084b9f324a004bea6d2, type: 2}
- - {fileID: 7400000, guid: 80b0945bbe9b94f468cc20801c050baf, type: 2}
- - {fileID: 7400000, guid: 3af4a4fdd9720044bacfd86b0c3435b1, type: 2}
- - {fileID: 7400000, guid: f132e9d177395cc44a2e06c71cbd7849, type: 2}
- - {fileID: 7400000, guid: 154fc7715a2686b43ba21cd2178be9a9, type: 2}
- - {fileID: 7400000, guid: 1a50f1532c8bfe644869ccd4c1379a9e, type: 2}
- - {fileID: 7400000, guid: 6543c9aee7b3f7b4d80c8f87fdf3c837, type: 2}
- - {fileID: 7400000, guid: d2551386674378f4cbedd917bf6348c5, type: 2}
- - {fileID: 7400000, guid: 76fde77dd4724694eb0955b10a0d54e4, type: 2}
- - {fileID: 7400000, guid: 1c1b573ac9e8cb947afae3a21b84a6ce, type: 2}
- - {fileID: 7400000, guid: 5dfb4ccf3e0777d4f84f764949fba8a6, type: 2}
- - {fileID: 7400000, guid: 5dfb4ccf3e0777d4f84f764949fba8a6, type: 2}
- - {fileID: 7400000, guid: 95825ba91d25c0d4883ab6879910778e, type: 2}
+ - {fileID: 11400000, guid: 465e1900de911cf459993dad9679d400, type: 2}
+ - {fileID: 11400000, guid: 3a87e7e029e8cf846b82e8841c2958d9, type: 2}
+ - {fileID: 11400000, guid: 79adafa8b05ca4e489ed3b5997e0a9d6, type: 2}
+ - {fileID: 11400000, guid: d45e980eb7e4ad94c81d82fd3a8fa3f8, type: 2}
+ - {fileID: 11400000, guid: 4475e75b43ad6444fb30e0e8be4441c9, type: 2}
+ - {fileID: 11400000, guid: 6a67c2d0900c457408446f2b0c211c6f, type: 2}
+ - {fileID: 11400000, guid: 9691afd369074084bafc4ec2510f3d06, type: 2}
+ - {fileID: 11400000, guid: 6feb0fe62f63c214da5c047101af854b, type: 2}
+ - {fileID: 11400000, guid: 44d476a9378911944aedee846407fa2c, type: 2}
+ - {fileID: 11400000, guid: d7d96ea77c3e7e047b0c0dc0309749eb, type: 2}
+ - {fileID: 11400000, guid: e0a933df8d3179f419fc12301201b69e, type: 2}
+ - {fileID: 11400000, guid: 8aa329a6d983d9d40af0c8090f0f122d, type: 2}
+ - {fileID: 11400000, guid: 097e8508fa718124eb0113312d48637f, type: 2}
+ - {fileID: 11400000, guid: 1c1857d54bd8c4b4092b7ac82f16a21f, type: 2}
+ - {fileID: 11400000, guid: 1c1857d54bd8c4b4092b7ac82f16a21f, type: 2}
+ - {fileID: 11400000, guid: ec8e24c834bbf4e4b8d2b4303c7cbe79, type: 2}
diff --git a/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_2.asset b/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_2.asset
index 2f8ff75c..1072a25e 100644
--- a/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_2.asset
+++ b/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_2.asset
@@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cab6406109041434e890f22d6455172f, type: 3}
- m_Name: Air_Combo03_Z0_2(Clone)
+ m_Name: Air_Combo03_Z0_2
m_EditorClassIdentifier:
animationName: Air_Combo03_Z0_2
animationPath: Assets/Bundle/Unit/PC/Erika/AnimationClip/Air_Combo03_Z0_2.anim
diff --git a/Erika/Assets/Scripts/Test2/TestErika.cs b/Erika/Assets/Scripts/Test2/TestErika.cs
index c6025964..e21fe75e 100644
--- a/Erika/Assets/Scripts/Test2/TestErika.cs
+++ b/Erika/Assets/Scripts/Test2/TestErika.cs
@@ -70,16 +70,17 @@ public class TestErika : SingletonMB<TestErika>
RootMotionProxy rootMotionProxy = erika.unit.GetOrAddComponent<RootMotionProxy>();
- Animator animator = erika.unit.GetComponent<Animator>();
- //AnimatorOverrideController animCtr = new AnimatorOverrideController(erika.animController);
- //animCtr.name = erika.unitPrefab.name + " Override Controller";
- //foreach(var anim in erika.actionData.actions)
- //{
- // animCtr[anim.Key] = anim.Value;
- //}
- animator.runtimeAnimatorController = erika.animController;
-
- Debug.Assert(animator.runtimeAnimatorController is AnimatorOverrideController);
+ AnimatorOverrideController overrideController = new AnimatorOverrideController(erika.animController);
+ overrideController.name = "Override Controller";
+ var itAction = erika.actionData.actions.GetEnumerator();
+ while(itAction.MoveNext())
+ {
+ string state = itAction.Current.Key;
+ string path = itAction.Current.Value.animationPath;
+ var clip = ResourceManager.Instance.LoadAsset<AnimationClip>(path);
+ overrideController[state] = clip;
+ }
+ erika.unit.GetComponent<Animator>().runtimeAnimatorController = overrideController;
unitCtr.pcState.ChangeState(PCState.EUnitState.Idle, new PCState.IdleParam(), true);
diff --git a/Erika/Assets/Scripts/Unit/AnimationData.cs b/Erika/Assets/Scripts/Unit/AnimationData.cs
index 9af3d51c..21d90028 100644
--- a/Erika/Assets/Scripts/Unit/AnimationData.cs
+++ b/Erika/Assets/Scripts/Unit/AnimationData.cs
@@ -178,7 +178,10 @@ public class RootMotionOverrideData
}
}
-// 某个动画的数据,包括帧事件、碰撞盒、速度曲线
+
+/// <summary>
+/// 单个动画的数据,包括帧事件、碰撞盒、速度曲线
+/// </summary>
[CreateAssetMenu(fileName = "Animation Data")]
public class AnimationData : ScriptableObject
{
diff --git a/Erika/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs b/Erika/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs
index 0f4f4e11..1714a9dd 100644
--- a/Erika/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs
+++ b/Erika/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs
@@ -69,8 +69,6 @@ public class PCAnimation : UnitAnimation
get { return layers[(int)ELayer.Basic]; }
}
- private UnitActionData m_ActionData;
-
public bool applyRootMotion { get; set; }
public bool applyRootCurve { get; set; } // 程序生成的root motion
diff --git a/Erika/Assets/Scripts/Unit/Components/UnitAnimation/UnitAnimation.cs b/Erika/Assets/Scripts/Unit/Components/UnitAnimation/UnitAnimation.cs
index 653564b7..593bd7b2 100644
--- a/Erika/Assets/Scripts/Unit/Components/UnitAnimation/UnitAnimation.cs
+++ b/Erika/Assets/Scripts/Unit/Components/UnitAnimation/UnitAnimation.cs
@@ -244,7 +244,10 @@ public class AnimatorLayerInfo
[DisallowMultipleComponent]
public class UnitAnimation : UnitComponent
-{
+{
+ // 角色的所有动作数据,包括(动画、事件、RM)
+ protected UnitActionData m_ActionData;
+
protected AnimatorLayerInfo[] layers { get { return m_LayerInfo; } }
protected AnimatorLayerInfo[] m_LayerInfo;
diff --git a/Erika/Assets/Scripts/Unit/UnitActionData.cs b/Erika/Assets/Scripts/Unit/UnitActionData.cs
index cdc7636f..75ccee57 100644
--- a/Erika/Assets/Scripts/Unit/UnitActionData.cs
+++ b/Erika/Assets/Scripts/Unit/UnitActionData.cs
@@ -4,7 +4,8 @@ using System.Collections.Generic;
using UnityEngine;
[Serializable]
-public class TriggerAnimationDictionary : SerializableDictionary<string/*override clip name\state name*/, AnimationData> { }
+public class TriggerAnimationDictionary
+ : SerializableDictionary<string/*override clip name\state name*/, AnimationData> { }
/// <summary>
/// 角色动作配置,状态名-动作
@@ -12,5 +13,9 @@ public class TriggerAnimationDictionary : SerializableDictionary<string/*overrid
[CreateAssetMenu(fileName = "Unit Action Data")]
public class UnitActionData : ScriptableObject
{
+ [Tooltip("所参照的AnimatorController")]
+ public RuntimeAnimatorController referenceController;
+
public TriggerAnimationDictionary actions;
+
}