static public AIGoal ParseGoalXML(CommonAI ai, string xmlData) { if (xmlData == null) { return(null); } if (xmlData.Length == 0) { return(null); } XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlData); XmlNode node = xmlDoc.FirstChild; if (node.Name != "root") { return(null); } bool loop = node.Attributes["loop"] != null?System.Convert.ToBoolean(node.Attributes["loop"].Value) : false; AIGoalCompositeGoal rootGoal = new AIGoalCompositeGoal(ai, loop); XmlNodeList nodeList = node.ChildNodes; for (int i = 0; i < nodeList.Count; i++) { AIGoal goal = ParseGoalNode(ai, nodeList[i]); if (goal == null) { return(null); } rootGoal.AddSubGoal(goal); } return(rootGoal); }
public AIState(CommonAI ai) { mAI = ai; mGoalQueue = new AIGoalCompositeGoal(mAI, false); }