protected void AddChildren(State state, XmlNodeList childNodes) { foreach (XmlNode childList in childNodes) { if (childList.Name == "children") { foreach (XmlNode child in childList.ChildNodes) { foreach (XmlAttribute attribute in child.Attributes) { if (attribute.Name.Equals("id")) { int value = StateIds.Index(attribute.Value); if (value != StateIds.NONE) { state.AddChild(value); } break; } } } break; } } }
protected void LoadChildState(string childId) { State state = stateManager.GetState(StateId); if ((state.Children != null) && state.Children.Contains(StateIds.Index(childId))) { stateManager.SetState(StateIds.Index(childId)); } else { throw new Exception("IStateController: 'LoadChildState' can only be called with one of its children state!"); } }
protected virtual void GetAttributes(StateData data, XmlAttributeCollection attributes) { foreach (XmlAttribute attribute in attributes) { if (attribute.Name.Equals("id")) { data.id = StateIds.Index(attribute.Value); } else if (attribute.Name.Equals("scene")) { data.scene = attribute.Value; } else if (attribute.Name.Equals("next")) { data.next = StateIds.Index(attribute.Value); } else if (attribute.Name.Equals("restartable")) { data.restartable = ToBool(attribute.Value, data.restartable); } } }