private static void GameTicker_Tick(object sender, EventArgs e)
 {
     try
     {
         gameWnd.Tick++;
         if (gameWnd.Tick == 10)
         {
             gameWnd.OnCreated();
         }
         else if (gameWnd.Tick > 10)
         {
             gameWnd.OnUpdate();
             if (gameWnd.CurrentScene != null)
             {
                 gameWnd.CurrentScene.OnUpdate();
                 CallGameObjectsUpdates();
                 GameWindowBridge.CurrentTick = gameWnd.Tick;
                 OnGameTickEvent?.Invoke(null, null);
             }
         }
     }
     catch (Exception ex)
     {
         gameTicker.Stop();
         CrashHandler?.Crash(ex);
     }
 }
 private static void GameCollisionUpdater_Tick(object sender, EventArgs e)
 {
     try
     {
         if (gameWnd.Tick > 10)
         {
             if (gameWnd.CurrentScene != null)
             {
                 UpdateCollisions();
             }
         }
     }
     catch (Exception ex)
     {
         gameCollisionUpdater.Stop();
         CrashHandler?.Crash(ex);
     }
 }
 private static void GameDrawer_Tick(object sender, EventArgs e)
 {
     try
     {
         gameWnd.Frame++;
         if (gameWnd.Tick > 10)
         {
             if (gameWnd.CurrentScene != null)
             {
                 gameWnd.CurrentScene.Draw();
             }
         }
     }
     catch (Exception ex)
     {
         gameDrawer.Stop();
         CrashHandler?.Crash(ex);
     }
 }
 /// <summary>
 /// Runs game process, creates game application data directory with path <paramref name="applicationDataFolder"/> and shows <paramref name="gameWindow"/>
 /// </summary>
 /// <param name="gameWindow">Main game window</param>
 /// <param name="applicationDataFolder">Path to root of Game at %AppData%</param>
 public static void Run(GameWindow gameWindow, string applicationDataFolder)
 {
     try
     {
         AppDataGameRoot = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), applicationDataFolder);
         if (!Directory.Exists(AppDataGameRoot))
         {
             Directory.CreateDirectory(AppDataGameRoot);
         }
         LoadAssemblyData();
         GameEngineContent.SystemContent = new ContentStorage(@"engine\system");
         gameWnd                       = gameWindow;
         gameWnd.KeyDown              += GameWnd_KeyDown;
         gameWnd.KeyUp                += GameWnd_KeyUp;
         gameWnd.IsActive              = true;
         gameTicker.Tick              += GameTicker_Tick;
         tickrateCounter.Tick         += TickrateCounter_Tick;
         gameDrawer.Tick              += GameDrawer_Tick;
         gameCollisionUpdater.Tick    += GameCollisionUpdater_Tick;
         gameTicker.Interval           = 16;
         tickrateCounter.Interval      = 1500;
         gameDrawer.Interval           = 16;
         gameCollisionUpdater.Interval = 16;
         gameTicker.Start();
         gameCollisionUpdater.Start();
         gameDrawer.Start();
         tickrateCounter.Start();
         IsProcessActive = true;
         Application.Run(gameWnd);
     }
     catch (Exception ex)
     {
         if (CrashHandler != null)
         {
             CrashHandler.Crash(ex);
         }
         else
         {
             throw ex;
         }
     }
 }