#region File Description
//-----------------------------------------------------------------------------
// CustomAvatarAnimationData.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
#endregion
namespace CustomAvatarAnimation
{
///
/// The type contains the animation data for a single animation
///
public class CustomAvatarAnimationData
{
///
/// The name of the animation clip
///
[ContentSerializer]
public string Name { get; private set; }
///
/// The total length of the animation.
///
[ContentSerializer]
public TimeSpan Length { get; private set; }
///
/// A combined list containing all the keyframes for all bones,
/// sorted by time.
///
[ContentSerializer]
public List Keyframes { get; private set; }
///
/// A combined list containing all the keyframes for expressions,
/// sorted by time.
///
[ContentSerializer]
public List ExpressionKeyframes { get; private set; }
#region Initialization
///
/// Private constructor for use by the XNB deserializer.
///
private CustomAvatarAnimationData() { }
///
/// Constructs a new CustomAvatarAnimationData object.
///
/// The name of the animation.
/// The length of the animation.
/// The keyframes in the animation.
public CustomAvatarAnimationData(string name, TimeSpan length,
List keyframes,
List expressionKeyframes)
{
// safety-check the parameters
if (String.IsNullOrEmpty(name))
{
throw new ArgumentNullException("name");
}
if (length <= TimeSpan.Zero)
{
throw new ArgumentOutOfRangeException("length",
"The length of the animation cannot be zero.");
}
if ((keyframes == null) || (keyframes.Count <= 0))
{
throw new ArgumentNullException("keyframes");
}
// assign the parameters
Name = name;
Length = length;
Keyframes = keyframes;
ExpressionKeyframes = expressionKeyframes;
}
#endregion
}
}