From 172d4723c7405d2e748ed03267ca10be9711212b Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 9 Jul 2021 19:17:38 +0800 Subject: *misc --- Assets/Scripts/Unit/AnimationData.cs | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'Assets/Scripts/Unit/AnimationData.cs') diff --git a/Assets/Scripts/Unit/AnimationData.cs b/Assets/Scripts/Unit/AnimationData.cs index 4ee79cf9..8717cf87 100644 --- a/Assets/Scripts/Unit/AnimationData.cs +++ b/Assets/Scripts/Unit/AnimationData.cs @@ -27,4 +27,48 @@ public class AnimationData : ScriptableObject return hurt + hit + thro + block + defend; } + public void AddBox(List boxList, ColliderData box) + { + if (boxList == null) + { + boxList = new List(); + return; + } + boxList.Add(box); + } + + public void DeleteBox(ColliderData box) + { + if (hurtBoxes != null) hurtBoxes.Remove(box); + if (hitBoxes != null) hitBoxes.Remove(box); + if (throwBoxes != null) throwBoxes.Remove(box); + if (blockBoxes != null) blockBoxes.Remove(box); + if (defendBoxes != null) defendBoxes.Remove(box); + } + + public ColliderData GetColliderByIndex(int index) + { + if (hurtBoxes != null && hurtBoxes.Count > index) + return hurtBoxes[index]; + else + index -= hurtBoxes.Count; + if (hitBoxes != null && hitBoxes.Count > index) + return hitBoxes[index]; + else + index -= hitBoxes.Count; + if (throwBoxes != null && throwBoxes.Count > index) + return throwBoxes[index]; + else + index -= throwBoxes.Count; + if (blockBoxes != null && blockBoxes.Count > index) + return blockBoxes[index]; + else + index -= blockBoxes.Count; + if (defendBoxes != null && defendBoxes.Count > index) + return defendBoxes[index]; + else + index -= defendBoxes.Count; + return null; + } + } -- cgit v1.1-26-g67d0