Exemplo n.º 1
0
    /// <summary>
    /// 把已经加载的模型资源与Node进行关联
    /// </summary>
    /// <param name="modelPath"></param>
    /// <param name="node"></param>
    /// <param name="modelInfo"></param>
    void AssignModelToNode(string modelPath, ModelNode node, ModelBaseInfo modelInfo)
    {
        foreach (var frameName in modelInfo.frames)
        {
            var framePath = string.Format("{0}/{1}", modelPath, frameName);
            var frame     = GetFrame(framePath);
            node.AssignFrame(ModelNode.NameToId(frameName), frame);
        }

        foreach (var animationName in modelInfo.actions.Keys)
        {
            var animationPath = string.Format("{0}/{1}", modelPath, animationName);
            var animation     = GetAnimation(animationPath);
            node.AssignAnimation(ModelNode.NameToId(animationName), animation);
        }
    }