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;
|
|
|
|
|
|
|
|
|
|
public Skeleton(Transform[] transforms)
|
|
|
|
|
{
|
|
|
|
|
if (transforms != null)
|
|
|
|
|
{
|
|
|
|
|
_bones = new Dictionary<string, Transform>(transforms.Length);
|
|
|
|
|
foreach (var t in transforms)
|
|
|
|
|
{
|
|
|
|
|
if (_bones.ContainsKey(t.name))
|
|
|
|
|
{
|
2023-10-19 15:00:19 +08:00
|
|
|
DebugUtil.LogError("Skeleton Add Bone, a bone has already been collected with same name : {0}", t.name);
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|