public static void Update(DwarfTime time) { lock (_mutex) { if (NextState != null && NextState.IsInitialized) { if (CurrentState != null) { CurrentState.OnCovered(); } CurrentState = NextState; NextState = null; } if (CurrentState != null && CurrentState.IsInitialized) { CurrentState.Update(time); } if (DwarfGame.IsConsoleVisible) { PerformanceMonitor.SetMetric("MEMORY", BytesToString(System.GC.GetTotalMemory(false))); var statsDisplay = DwarfGame.GetConsoleTile("STATS"); statsDisplay.Lines.Clear(); statsDisplay.Lines.Add("** STATISTICS **"); foreach (var metric in PerformanceMonitor.EnumerateMetrics()) { statsDisplay.Lines.Add(String.Format("{0} {1}", metric.Value.ToString(), metric.Key)); } statsDisplay.Invalidate(); } } }