public override StructRigidEntity toStruct()
 {
     StructRigidEntity sr = new StructRigidEntity();
     sr.friction = Friction;
     sr.restitution = Restitution;
     sr.gType = geomType;
     sr.name = ID;
     sr.textureName = texture.Name;
     return sr;
 }
 public RigidEntity(ContentManager cm, ref PhysicsSimulator phs, string xmlFileName)
     : base("FILE")
 {
     physicsSim = phs;
     //Stream stream = File.OpenRead(System.IO.Directory.GetCurrentDirectory()+"\\"+xmlFileName);
     //XmlSerializer xml = new XmlSerializer(typeof(StructRigidEntity));
     //StructRigidEntity re = (StructRigidEntity)xml.Deserialize(stream);
     StructRigidEntity re = new StructRigidEntity();
     re = cm.Load<StructRigidEntity>(xmlFileName);
     texture = cm.Load<Texture2D>(re.textureName);
     geomType = re.gType;
     preparePhysicsEntity(phs);
     IsDrawable = true;
     Friction = re.friction;
     Restitution = re.restitution;
     ID = re.name;
     //stream.Close();
 }
 /*
  * Public Methods
  */
 public override void Save(string fileName)
 {
     StructRigidEntity sr = new StructRigidEntity();
     sr.friction = Friction;
     sr.restitution = Restitution;
     sr.gType = geomType;
     sr.name = ID;
     sr.textureName = texture.Name;
     Stream s = File.OpenWrite(System.IO.Directory.GetCurrentDirectory() + "\\EntitySaves\\" + sr.name + ".xml");
     XmlSerializer xml = new XmlSerializer(typeof(StructRigidEntity));
     xml.Serialize(s, sr);
     s.Close();
 }