static void Main(string[] args)
        {
            IRenderer renderer = new ConsoleRenderer(WorldRows, WorldCols);
            IUserInterface keyboard = new KeyboardInterface();
            ShooterEngine gameEngine = new ShooterEngine(renderer, keyboard, 500);

            keyboard.OnLeftPressed += (sender, eventInfo) =>
            {
                gameEngine.MovePlayerRacketLeft();
            };

            keyboard.OnRightPressed += (sender, eventInfo) =>
            {
                gameEngine.MovePlayerRacketRight();
            };

            keyboard.OnActionPressed += (sender, eventInfo) =>
            {
                gameEngine.ShootPlayerRacket();
            };

            Initialize(gameEngine);
            CreateWalls(gameEngine);
            //
            WelcomeScreen();
            gameEngine.Run();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            IRenderer      renderer   = new ConsoleRenderer(WorldRows, WorldCols);
            IUserInterface keyboard   = new KeyboardInterface();
            ShooterEngine  gameEngine = new ShooterEngine(renderer, keyboard, 500);

            keyboard.OnLeftPressed += (sender, eventInfo) =>
            {
                gameEngine.MovePlayerRacketLeft();
            };

            keyboard.OnRightPressed += (sender, eventInfo) =>
            {
                gameEngine.MovePlayerRacketRight();
            };

            keyboard.OnActionPressed += (sender, eventInfo) =>
            {
                gameEngine.ShootPlayerRacket();
            };

            Initialize(gameEngine);
            CreateWalls(gameEngine);
            //
            WelcomeScreen();
            gameEngine.Run();
        }
        static void Main(string[] args)
        {
            IRenderer renderer = new ConsoleRenderer(WorldRows, WorldCols);
            IUserInterface keyboard = new KeyboardInterface();

            // Switched the constructor with the one where the thread sleep recives a value instead of having it hardcoded (TASK 02)
            // Also switched to ShooterEngine
            //===================================================================================================== Edit>
            ShooterEngine gameEngine = new ShooterEngine(renderer, keyboard, 150);
            //===================================================================================================== >Edit

            keyboard.OnLeftPressed += (sender, eventInfo) =>
            {
                gameEngine.MovePlayerRacketLeft();
            };

            keyboard.OnRightPressed += (sender, eventInfo) =>
            {
                gameEngine.MovePlayerRacketRight();
            };

            keyboard.OnActionPressed += (sender, eventInfo) =>
            {
                gameEngine.ShootPlayerRacket();
            };

            Initialize(gameEngine);

            //

            gameEngine.Run();
        }