protected override void OnUpdate() { processing.records.Clear(); processing.frame = frames++; for (int i = 0; i < agentGroup.Length; i++) { processing.records.Add(new AgentRecord { AgentID = agentGroup.Data[i].ID, Position = WindowManager.Crowds2Clouds(agentGroup.Position[i].Value), CloudID = agentGroup.OwnerCloud[i].CloudID }); } FrameRecord aux = complete; complete = processing; processing = aux; var inst = BioClouds.Parameters.Instance; if (!inst.SaveSimulationData) { return; } //Data recording #region BioClouds Datarecording NativeMultiHashMap <int, float3> cellmap = m_CellMarkSystem.cloudID2MarkedCellsMap; float3 currentCellPosition; NativeMultiHashMapIterator <int> it; //if ((inst.SaveDenstiies || inst.SavePositions)) //{ if (inst.MaxSimulationFrames > CurrentFrame && CurrentFrame % inst.FramesForDataSave == 0) { for (int i = 0; i < m_CloudDataGroup.Length; i++) { List <int> cellIDs = new List <int>(); if (!cellmap.TryGetFirstValue(m_CloudDataGroup.CloudData[i].ID, out currentCellPosition, out it)) { continue; } int2 grid_cell = GridConverter.PositionToGridCell(new float3(currentCellPosition.x, currentCellPosition.y, currentCellPosition.z)); cellIDs.Add(GridConverter.GridCell2CellID(grid_cell)); while (cellmap.TryGetNextValue(out currentCellPosition, ref it)) { grid_cell = GridConverter.PositionToGridCell(new float3(currentCellPosition.x, currentCellPosition.y, currentCellPosition.z)); cellIDs.Add(GridConverter.GridCell2CellID(grid_cell)); } if (inst.IDToRecord == -1 || m_CloudDataGroup.CloudData[i].ID == inst.IDToRecord) { BioClouds.Record record = new BioClouds.Record(frames, m_CloudDataGroup.CloudData[i].ID, m_CloudDataGroup.CloudData[i].AgentQuantity, cellIDs.Count, cellIDs, m_CloudDataGroup.Position[i].Value, m_CloudDataGroup.CloudData[i].Radius ); bioCloudsRecords.Add(record); } } } //if (inst.MaxSimulationFrames == CurrentFrame - 1) //{ using (System.IO.StreamWriter file = new System.IO.StreamWriter(inst.LogFilePath + "Clouds.txt", true)) { foreach (BioClouds.Record record in bioCloudsRecords) { file.Write(record.ToString() + '\n'); } } bioCloudsRecords.Clear(); //} //} #endregion #region BioCrowds DataRecording //if (inst.MaxSimulationFrames == CurrentFrame - 1) //{ using (System.IO.StreamWriter file = new System.IO.StreamWriter(inst.LogFilePath + "Agents.txt", true)) { file.Write(complete.ToString() + '\n'); } //} #endregion }