public static StoryElement fromXML(XmlNode node, Game gameref) { StoryElement element = new StoryElement(); element.pathSegments = new List <CameraPathSegment>(); element.audioElements = new List <AudioElement>(); element.beingControllers = new List <BeingController>(); foreach (XmlNode subnode in node.ChildNodes) { if (subnode.Name.Equals("aveXTrigger")) { element.aveXTrigger = int.Parse(subnode.FirstChild.Value); } else if (subnode.Name.Equals("startX")) { element.startX = float.Parse(subnode.FirstChild.Value); } else if (subnode.Name.Equals("cutsceneLength")) { element.cutsceneLength = int.Parse(subnode.FirstChild.Value); } else if (subnode.Name.Equals("pathSegments")) { foreach (XmlNode pathSegment in subnode.ChildNodes) { element.pathSegments.Add(CameraPathSegment.fromXML(pathSegment)); } } else if (subnode.Name.Equals("audioElements")) { foreach (XmlNode audioSegment in subnode.ChildNodes) { element.audioElements.Add(AudioElement.fromXML(audioSegment)); } } else if (subnode.Name.Equals("animations")) { foreach (XmlElement anim in subnode.ChildNodes) { element.beingControllers.Add(BeingController.fromXML(anim, gameref)); } } } return(element); }
public static BeingController fromXML(XmlElement element, Game gameref) { BeingController controller = new BeingController(); controller.entranceMS = int.Parse(element.GetAttribute("entranceMS")); controller.startDepth = int.Parse(element.GetAttribute("startDepth")); controller.animationController = gameref.animationManager.getController(element.GetAttribute("animationName")); foreach (XmlElement locElement in element.GetElementsByTagName("startLocation")) { controller.startLocation = XMLUtil.fromXMLVector2(locElement); } foreach (XmlElement animationElement in element.GetElementsByTagName("timeAnimationStruct")) { controller.animations.Add(TimeAnimationStruct.fromXML(animationElement)); } foreach (XmlElement actionElement in element.GetElementsByTagName("action")) { controller.actions.Add(ActionStruct.fromXML(actionElement)); } return(controller); }