/// <summary>
        /// Setup constructor
        /// </summary>
        /// <param name="layerAnimations">The set of animations that this layer can use</param>
        /// <param name="part">The body part associated with this layer</param>
        public AnimationLayer( AnimationSet layerAnimations, ModelPart part )
        {
            m_Animations = layerAnimations;

            switch ( part )
            {
                case ModelPart.Head		:	m_IdleAnim = AnimationType.NumAnimations;	break;
                case ModelPart.Upper	:	m_IdleAnim = AnimationType.TorsoStand;		break;
                case ModelPart.Lower	:	m_IdleAnim = AnimationType.LegsIdle;		break;
            };

            if ( m_IdleAnim != AnimationType.NumAnimations )
            {
                PlayAnimation( m_Animations.GetAnimation( m_IdleAnim ) );
            }
        }
        /// <summary>
        /// Loads in model animations
        /// </summary>
        public AnimationSet LoadAnimations( ISource source )
        {
            using ( Stream inputStream = OpenStream( source ) )
            {
                TextReader		reader		= new StreamReader( inputStream );
                char[]			tokenSplit	= new char[ ] { ' ', '\t' };
                AnimationSet	animations	= new AnimationSet( );

                //	Run through all the lines in the file
                int animIndex = 0;
                for ( string curLine = reader.ReadLine( ); curLine != null; curLine = reader.ReadLine( ) )
                {
                    string[] tokens = curLine.Split( tokenSplit );

                    if ( ( tokens.Length == 0 ) || ( tokens[ 0 ] == string.Empty ) )
                    {
                        //	Empty line - ignore it
                        continue;
                    }
                    if ( tokens[ 0 ] == "//" )
                    {
                        //	Line begins with comment - ignore it
                        continue;
                    }
                    if ( tokens[ 0 ] == "sex" || tokens[ 0 ] == "headoffset" || tokens[ 0 ] == "footsteps" )
                    {
                        //	Model gender/head offset/footsteps - ignore it
                        continue;
                    }

                    //	Line must be an animation specification, which is 4 whitespace separated integers, A B C D
                    //	where A is the first frame of the anim, B is the number of frames, C is the number of looping frames, and D
                    //	is the number of frames per second
                    int firstFrame		= int.Parse( tokens[ 0 ] );
                    int numFrames		= int.Parse( tokens[ 1 ] );
                    int loopingFrames	= int.Parse( tokens[ 2 ] );
                    int framesPerSecond	= int.Parse( tokens[ 3 ] );

                    Animation curAnim = new Animation( ( AnimationType )animIndex, firstFrame, numFrames, loopingFrames, framesPerSecond );

                    animations.Animations[ animIndex++ ] = curAnim;
                }

                //	Correct leg animation frames
                int firstLegFrame	= animations.Animations[ ( int )AnimationType.FirstLegAnim ].FirstFrame;
                int firstTorsoFrame	= animations.Animations[ ( int )AnimationType.FirstTorsoAnim ].FirstFrame;
                int legCorrection	= firstLegFrame - firstTorsoFrame;
                for ( animIndex = ( int )AnimationType.FirstLegAnim; animIndex < ( int )AnimationType.NumAnimations; ++animIndex )
                {
                    animations.Animations[ animIndex ].FirstFrame -= legCorrection;
                }

                return animations;
            }
        }