MrGravity.Import_Code.EntityInfo.EntityInfo C# (CSharp) Méthode

EntityInfo() public méthode

Creates an entity out of an XElement that defiens an entity
public EntityInfo ( System.Xml.Linq.XElement entity ) : System.Collections.Generic
entity System.Xml.Linq.XElement The XML chunck that defines this entity
Résultat System.Collections.Generic
        public EntityInfo(XElement entity)
        {
            MProperties = new Dictionary<string,string>();
            foreach(var item in entity.Elements())
            {
                if (item.Name == XmlKeys.Id)
                    MId = int.Parse(item.Value);
                if (item.Name == XmlKeys.Name)
                    MName = item.Value;
                if (item.Name == XmlKeys.Type)
                    MType = item.Value;
                if (item.Name == XmlKeys.CollisionType)
                    MCollisionType = item.Value;
                if (item.Name == XmlKeys.Texture)
                    MTextureFile = item.Value;
                if (item.Name == XmlKeys.Trigger)
                    MTrigger = XmlKeys.True.Equals(item.Value);
                if (item.Name == XmlKeys.Location)
                    MLocation = new Vector2(int.Parse(item.Attribute(XName.Get("X", "")).Value),
                        int.Parse(item.Attribute(XName.Get("Y", "")).Value));
                if (item.Name == XmlKeys.Properties)
                    foreach (var property in item.Elements())
                        MProperties.Add(property.Name.ToString(), property.Value);
            }
        }

Same methods

EntityInfo::EntityInfo ( string name, Vector2 startLocation ) : System.Collections.Generic