NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Framework/Skeleton.cs

43 lines
1.1 KiB
C#
Raw Normal View History

2023-08-22 19:08:45 +08:00
using System.Collections.Generic;
using UnityEngine;
#if ! RENDER_SERVER
#endif
namespace Framework
{
public class Skeleton
{
private Dictionary<string, Transform> _bones;
2024-07-03 17:00:17 +08:00
private Transform _root;
2023-08-22 19:08:45 +08:00
2024-07-03 17:00:17 +08:00
public Skeleton(Transform[] transforms, Transform root)
2023-08-22 19:08:45 +08:00
{
2024-07-03 17:00:17 +08:00
_root = root;
2023-08-22 19:08:45 +08:00
if (transforms != null)
{
_bones = new Dictionary<string, Transform>(transforms.Length);
foreach (var t in transforms)
{
if (_bones.ContainsKey(t.name))
{
2026-02-05 13:30:28 +08:00
DebugUtil.LogError("Skeleton 存在重复的物体名字 : {0}, root: {1}", t.name, _root.transform);
2023-08-22 19:08:45 +08:00
continue;
}
_bones.Add(t.name, t);
}
}
}
public Transform GetBone(string name)
{
Transform bone = null;
if (_bones != null && _bones.TryGetValue(name, out bone))
{
}
return bone;
}
}
}