/// <summary> /// uses new received track to update the cognitive intervention tree /// </summary> /// <param name="track"> track received from the game. </param> internal void addNewTrack(string track) { loggingCI("New track added: '" + track + "'."); CognitiveInterventionTree tree = getCognitiveInterventionTree(); foreach (CognitiveInterventionNode node in this.cognitiveInterventionTree.nodes) { node.wasActivatedThisUpdate = false; } List <string> listOfActiveNodeIds = tree.getListOfActiveNodeIds(); foreach (string nodeId in listOfActiveNodeIds) { CognitiveInterventionNode node = tree.getCognitiveInterventionNodeById(nodeId); if (node.isStillActive()) { if (node.edges.ContainsKey(track)) { if (node.edges[track].active) { tree.setActive(node, track); } } } } tree.logActiveNodes(); }
/// <summary> /// Method for intervention trigger check /// </summary> internal void refresh() { CognitiveInterventionTree tree = getCognitiveInterventionTree(); List <string> listOfActiveNodeIds = tree.getListOfActiveNodeIds(); foreach (string nodeId in listOfActiveNodeIds) { CognitiveInterventionNode node = tree.getCognitiveInterventionNodeById(nodeId); node.isStillActive(); } }
/// <summary> /// Loading the CognitiveInterventionTree for the Asset Handler /// </summary> internal void loadCognitiveInterventionTree() { loggingCI("Loading CognitiveIntervention XML-datastructure."); CognitiveInterventionAssetSettings cias = (CognitiveInterventionAssetSettings)getCIA().Settings; IDataStorage ids = CognitiveInterventionAsset.Instance.getInterfaceFromAsset <IDataStorage>(); if (ids != null) { if (!ids.Exists(cias.XMLFileLocation)) { loggingCI("File " + cias.XMLFileLocation + " not found for loading CognitiveIntervention XML-datastructure.", Severity.Error); throw new Exception("EXCEPTION: File " + cias.XMLFileLocation + " not found for loading CognitiveIntervention XML-datastructure."); } loggingCI("Loading CognitiveIntervention XML-datastructure from File."); cognitiveInterventionTree = new CognitiveInterventionTree(getDatastructureFromXmlString(ids.Load(cias.XMLFileLocation))); } else { loggingCI("IDataStorage bridge absent for loading CognitiveIntervention XML-datastructure.", Severity.Error); throw new Exception("EXCEPTION: IDataStorage bridge absent for loading CognitiveIntervention XML-datastructure."); } }