private void ShutDown()
{
_shutDownRequestFlag = true;
KeyDown -= OnKeyDown;
Tick -= OnTick;
_shutDownRequestedEvent.WaitOne(100);
Debug.Log("Begin ShutDown");
_settingsStorage.SaveSettings(_settings);
//General
RecordGameSessionEnded();
if (_controlsProcessor != null)
{
_controlsProcessor.Dispose();
_controlsProcessor = null;
}
//Window
if (_foregroundWindowWatcher != null)
{
_foregroundWindowWatcher.Dispose();
_foregroundWindowWatcher = null;
}
//Menu
if (_settingsMenu != null)
{
_settingsMenu = null;
}
//Features
if (_aiming != null)
{
_aiming.Dispose();
_aiming = null;
}
if (_extendedView != null)
{
_extendedView.Dispose();
_extendedView = null;
}
//Hids
if (_controllerEmulation != null)
{
_controllerEmulation.Enabled = false;
_controllerEmulation.RemoveHooks();
_controllerEmulation = null;
}
if (_tobiiTracker != null)
{
_tobiiTracker.Dispose();
_tobiiTracker = null;
}
Debug.Log("End ShutDown");
}