public void LoadHistory() { simController.LoadSimulation(); supervisor.ResetCommandList(); }
protected override IEnumerator UpdateScene() { Debug.Log("Updating scenario..."); // scan each data info in the scenario and add missing objects in the scene foreach (VrXmlEntityData entity in scenarioData.entityList) { if (!entityObjects.ContainsKey(entity.id)) { GameObject go = new GameObject();//GameObject.CreatePrimitive(PrimitiveType.Cube); EntityData entityData = go.AddComponent <EntityData>(); entityData.id = entity.id; entityObjects.Add(entity.id, go); } if (entity.representation != null) { representationCount++; } } yield return(new WaitForSecondsRealtime(0.2f)); Debug.Log("Updating entities..."); // scan each data info in the scenario and (add and) update objects in the scene foreach (VrXmlEntityData entity in scenarioData.entityList) { if (entityObjects.ContainsKey(entity.id)) { UpdateObject(entityObjects[entity.id], entity); #if UNITY_EDITOR if (progressDelay > 0) { yield return(new WaitForSecondsRealtime(progressDelay)); } #endif if (entity.representation != null) { yield return(CreateRepresentationObject(entityObjects[entity.id].GetComponent <EntityData>(), entity.representation)); } updatedEntities++; } } Debug.Log("Updating relationships..."); // scan each relationship in the scenario and (add and) update components in the scene foreach (VrXmlRelationship entity in scenarioData.relationshipList) { ConvertEntityRelationship(entity); } if (scenarioData.simulation != null) { Debug.Log("Loading simulation..."); SimController simController = GetComponent <SimController>(); if (simController == null) { simController = gameObject.AddComponent <SimController>(); } simController.simulationHistory.historyUri = scenarioData.simulation.historyUri; simController.simulationHistory.historyName = scenarioData.simulation.historyName; simController.simulationHistory.description = scenarioData.simulation.description; simController.simulationHistory.details = scenarioData.simulation.details; // scan each history in the scenario and (add and) update components in the scene foreach (VrXmlHistoryData history in scenarioData.simulation.historyList) { ConvertEntityHistory(history); } simController.LoadSimulation(); if (scenarioData.simulation.autoStart) { simController.PlaySimulation(); } } Debug.Log("Scenario updated."); }