Example #1
0
        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);
        }
Example #2
0
        public static ActionStruct fromXML(XmlElement actionElement)
        {
            ActionStruct str = new ActionStruct();

            foreach (XmlElement ele in actionElement.ChildNodes)
            {
                if (ele.Name == "actionEnum")
                {
                    str.action = (ActionEnum)Enum.Parse(typeof(ActionEnum), ele.FirstChild.Value);
                }
                else if (ele.Name == "time")
                {
                    str.time = int.Parse(ele.FirstChild.Value);
                }
                else if (ele.Name == "intensity")
                {
                    str.intensity = float.Parse(ele.FirstChild.Value);
                }
            }
            return(str);
        }