public IIncludedObject Load(Project project, XElement xmlNode)
        {
            var effect = _effectReader.Load(xmlNode);

            project.AddFunction(effect);
            return(effect);
        }
        public IIncludedObject Load(Project project, XElement xmlNode)
        {
            var info = new EntityInfo()
            {
                Name        = xmlNode.RequireAttribute("name").Value,
                MaxAlive    = xmlNode.TryAttribute <int>("maxAlive", 50),
                GravityFlip = xmlNode.TryElementValue <bool>("GravityFlip"),
                Components  = new List <IComponentInfo>()
            };

            ReadEditorData(xmlNode, info);

            var deathNode = xmlNode.Element("Death");

            if (deathNode != null)
            {
                info.Death = _effectReader.Load(deathNode);
            }

            foreach (var compReader in ComponentReaders)
            {
                var element = compReader.NodeName != null?xmlNode.Element(compReader.NodeName) : xmlNode;

                if (element != null)
                {
                    var comp = compReader.Load(element, project);
                    if (comp != null)
                    {
                        info.Components.Add(comp);
                    }
                }
            }

            if (info.PositionComponent == null)
            {
                info.Components.Add(new PositionComponentInfo());
            }

            if (info.MovementComponent == null && HasMovementEffects(info))
            {
                info.Components.Add(new MovementComponentInfo()
                {
                    EffectInfo = new MovementEffectPartInfo()
                });
            }

            project.AddEntity(info);
            return(info);
        }
Beispiel #3
0
        public SceneCommandInfo Load(XElement node, string basePath)
        {
            var info = new SceneEffectCommandInfo();

            info.GeneratedName = Guid.NewGuid().ToString();

            var attr = node.Attribute("entity");

            if (attr != null)
            {
                info.EntityId = attr.Value;
            }

            info.EffectInfo = _effectReader.Load(node);

            return(info);
        }