public void Read(XmlTextReader reader, Thinker thinker) { bool done = false; Transitioner trans = null; Expression exp = null; while (!done) { reader.Read(); if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "StateDefinition") { done = true; } // Process a start of element node. else if (reader.NodeType == XmlNodeType.Element) { // Process a text node. if (reader.Name == "Target") { while (reader.NodeType != XmlNodeType.Text) { reader.Read(); } AIState state = thinker.GetState(reader.Value); exp = new Expression(); trans = new Transitioner(exp, state); AddTransitioner(trans); trans.Read(reader, thinker); } if (reader.Name == "StateAction") { while (reader.NodeType != XmlNodeType.Text) { reader.Read(); } Thinker.ActionMethod method = Thinker.GetAction(reader.Value); m_actions.Add(method); } } } // End while loop }
public void AddTransitioner(Transitioner trans) { m_transition_list.Add(trans); }