public void Save()
{
List<XmlEntity> xmlentities = new List<XmlEntity>();
XmlLevel xmllevel = new XmlLevel(name, id, xmlentities);
for (int i = 0; i < entities.Count; i++)
{
Entity entity = entities[i];
XmlEntity xmlentity = new XmlEntity();
xmlentity.position = entity.position;
xmlentity.rotation = entity.rotation;
xmlentity.size = entity.size;
if (entity is StaticModelEntity)
{
StaticModelEntity modelentity = entity as StaticModelEntity;
xmlentity.asset = Resources.GetName(modelentity.GetModel());
xmlentity.type = "static_model";
}
if (entity is AnimatedModelEntity)
{
AnimatedModelEntity modelentity = entity as AnimatedModelEntity;
xmlentity.asset = Resources.GetName(modelentity.GetModel());
xmlentity.type = "animated_model";
}
if (entity is WallModelEntity)
{
WallModelEntity wallentity = entity as WallModelEntity;
xmlentity.asset = Resources.GetName(wallentity.GetModel());
xmlentity.type = "wall_model";
}
if (entity is Billboard)
{
Billboard billboard = entity as Billboard;
xmlentity.asset = Resources.GetName(billboard.region.texture);
xmlentity.type = "billboard";
xmlentity.color = billboard.color;
}
xmlentities.Add(xmlentity);
}
XmlHelper.Save(xmllevel);
}