private void LogicTick() { lock (_threadLockObj) { foreach (ScriptContext ctx in Scripts.ToArray()) // Copy the list so a script ending/starting does not crash here { ctx.LogicTick(); } foreach (MessageBox mb in MessageBoxes.ToArray()) { mb.LogicTick(); } Tileset.AnimationTick(); // TODO: Don't run in battles like we are now if (_battleTransition != null || _fadeFromTransition != null || _fadeToTransition != null) { return; } if (_battleGUI != null) { _battleGUI.LogicTick(); return; } _overworldGUI.LogicTick(); } }