public static void Main(params string[] commandLineArgs) { isDebugMode = commandLineArgs.Contains("-debug"); gameForm.Show(); var gameFieldSize = new GameFieldSize(gameForm.GameFieldSize.Height, gameForm.GameFieldSize.Width); var renderersLoader = new ResourcesLoader(Path.Combine(PathHelpers.RootPath, "Resources"), playerSizesByStates, enemiesSizesByBehavior); texturesRepository = renderersLoader.LoadTextures(); var renderersSet = renderersLoader.LoadRenderers(); gameRenderer = new GameRenderer( new PointF(gameForm.GameFieldSize.Width - (float)gameFieldSize.Width, (float)gameFieldSize.Height), renderersSet); var game = new GameModel( new RandomBehaviorEnemyFactory(enemiesSizesByBehavior, StandingEnemyBehavior.Creator(), FlyingEnemyBehavior.Creator(1), FlyingEnemyBehavior.Creator(2), RunningEnemyBehavior.Creator(1), RunningEnemyBehavior.Creator(1.5)), gameFieldSize, playerSizesByStates); gameForm.KeyDown += (_, args) => keyboardController.KeyPressed(args.KeyCode); gameForm.KeyUp += (_, args) => keyboardController.KeyReleased(args.KeyCode); RedrawEnvironment(); using var timer = new Timer { Interval = BetweenTicksDelay }; timer.Tick += (_, __) => { game.Tick(keyboardController.ActiveAction); UpdateGameField(game); }; timer.Start(); Application.Run(gameForm); }