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

43 lines
1.1 KiB
C#

using System.Collections.Generic;
using UnityEngine;
#if ! RENDER_SERVER
#endif
namespace Framework
{
public class Skeleton
{
private Dictionary<string, Transform> _bones;
private Transform _root;
public Skeleton(Transform[] transforms, Transform root)
{
_root = root;
if (transforms != null)
{
_bones = new Dictionary<string, Transform>(transforms.Length);
foreach (var t in transforms)
{
if (_bones.ContainsKey(t.name))
{
DebugUtil.LogError("Skeleton 存在重复的物体名字 : {0}, root: {1}", t.name, _root.transform);
continue;
}
_bones.Add(t.name, t);
}
}
}
public Transform GetBone(string name)
{
Transform bone = null;
if (_bones != null && _bones.TryGetValue(name, out bone))
{
}
return bone;
}
}
}