protected void ReadAnimation( BinaryReader reader )
{
// name of the animation
string name = ReadString( reader );
// length in seconds of the animation
float length = ReadFloat( reader );
// create an animation from the skeleton
Animation anim = skeleton.CreateAnimation( name, length );
// keep reading all keyframes for this track
if ( !IsEOF( reader ) )
{
SkeletonChunkID chunkID = ReadChunk( reader );
while ( !IsEOF( reader ) && ( chunkID == SkeletonChunkID.AnimationTrack ) )
{
// read the animation track
ReadAnimationTrack( reader, anim );
// read the next chunk id
// If we're not end of file get the next chunk ID
if ( !IsEOF( reader ) )
{
chunkID = ReadChunk( reader );
}
}
// backpedal to the start of the chunk
if ( !IsEOF( reader ) )
{
Seek( reader, -ChunkOverheadSize );
}
}
}