void ReadTimelineBone(XmlElement element, SpriterTimelineKey key)
{
SpriterTimelineBone bone = new SpriterTimelineBone();
key.objects.Add(bone);
Vector2 position = Vector2.zero, scale = Vector2.one;
Color color = Color.white;
foreach(XmlAttribute attribute in element.Attributes)
{
// x, y
if (attribute.Name.Equals("x"))
position.x = float.Parse(attribute.Value);
else if (attribute.Name.Equals("y"))
position.y = float.Parse(attribute.Value);
// angle
else if (attribute.Name.Equals("angle"))
bone.angle = float.Parse(attribute.Value);
// scale
else if (attribute.Name.Equals("scale_x"))
scale.x = float.Parse(attribute.Value);
else if (attribute.Name.Equals("scale_y"))
scale.y = float.Parse(attribute.Value);
// color
else if (attribute.Name.Equals("r"))
color.r = float.Parse(attribute.Value);
else if (attribute.Name.Equals("g"))
color.g = float.Parse(attribute.Value);
else if (attribute.Name.Equals("b"))
color.b = float.Parse(attribute.Value);
else if (attribute.Name.Equals("a"))
color.a = float.Parse(attribute.Value);
}
foreach(XmlElement child in element)
{
// meta_data
if (child.Name.Equals("meta_data"))
ReadMetaData(child, bone.metaData);
}
// Assign vector values
bone.position = position;
bone.scale = scale;
bone.color = color;
}