Esempio n. 1
0
 private void EntityCommand(SceneEntityCommandInfo command)
 {
     var entityId = command.Placement.Id ?? Guid.NewGuid().ToString();
     var entity = Entities.CreateEntityWithId(entityId, command.Placement.entity);
     entity.GetComponent<PositionComponent>().SetPosition(command.Placement.screenX, command.Placement.screenY);
     if (!string.IsNullOrEmpty(command.Placement.state))
     {
         entity.SendMessage(new StateMessage(null, command.Placement.state));
     }
     entity.Start(this);
 }
Esempio n. 2
0
 public static SceneEntityCommandInfo LoadEntityCommand(XElement node)
 {
     var info = new SceneEntityCommandInfo();
     info.Placement = LoadEntityPlacement(node);
     return info;
 }
 public static SceneEntityCommandInfo FromXml(XElement node)
 {
     var info = new SceneEntityCommandInfo();
     info.Entity = node.RequireAttribute("entity").Value;
     var nameAttr = node.Attribute("name");
     if (nameAttr != null) info.Name = nameAttr.Value;
     var stateAttr = node.Attribute("state");
     if (stateAttr != null) info.State = stateAttr.Value;
     info.X = node.GetInteger("x");
     info.Y = node.GetInteger("y");
     return info;
 }
 public SceneCommandInfo Load(XElement node, string basePath)
 {
     var info = new SceneEntityCommandInfo();
     info.Placement = _entityReader.Load(node);
     return info;
 }