示例#1
0
 /// <summary>
 /// Called whenever the bone the <see cref="Bone"/> component points to changed.
 /// </summary>
 /// <param name="bone">Bone component to modify.</param>
 internal void NotifyBoneChanged(Bone bone)
 {
     switch (state)
     {
         case State.Active:
             for (int i = 0; i < mappingInfo.Count; i++)
             {
                 if (mappingInfo[i].bone == bone)
                 {
                     _native.UnmapSceneObject(mappingInfo[i].sceneObject);
                     _native.MapCurveToSceneObject(bone.Name, mappingInfo[i].sceneObject);
                     break;
                 }
             }
             break;
     }
 }
示例#2
0
 /// <summary>
 /// Unregisters a bone component, removing the bone -> scene object mapping.
 /// </summary>
 /// <param name="bone">Bone to unregister.</param>
 internal void RemoveBone(Bone bone)
 {
     switch (state)
     {
         case State.Active:
             for (int i = 0; i < mappingInfo.Count; i++)
             {
                 if (mappingInfo[i].bone == bone)
                 {
                     _native.UnmapSceneObject(mappingInfo[i].sceneObject);
                     mappingInfo.RemoveAt(i);
                     i--;
                 }
             }
             break;
     }
 }
示例#3
0
        /// <summary>
        /// Registers a new bone component, creating a new transform mapping from the bone name to the scene object
        /// the component is attached to.
        /// </summary>
        /// <param name="bone">Bone component to register.</param>
        internal void AddBone(Bone bone)
        {
            switch (state)
            {
                case State.Active:
                    SceneObject currentSO = bone.SceneObject;

                    SceneObjectMappingInfo newMapping = new SceneObjectMappingInfo();
                    newMapping.sceneObject = currentSO;
                    newMapping.isMappedToBone = true;
                    newMapping.bone = bone;

                    mappingInfo.Add(newMapping);
                    _native.MapCurveToSceneObject(bone.Name, newMapping.sceneObject);
                    break;
            }
        }