コード例 #1
0
        static void Main(string[] args)
        {
            IRenderer      renderer = new ConsoleRenderer(WorldRows, WorldCols);
            IUserInterface keyboard = new KeyboardInterface();

            Engine gameEngine = new Engine(renderer, keyboard);

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

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

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

            keyboard.OnEnterPressed += (sender, eventInfo) =>
            {
                gameEngine.SpaceShipShootRocket();
            };

            keyboard.OnRPressed += (sender, eventInfo) =>
            {
                gameEngine.SpaceShipShootSuperRocket();
            };

            keyboard.OnZPressed += (sender, eventInfo) =>
            {
                gameEngine.SpaceShipShootLeftBlaster();
            };

            keyboard.OnXPressed += (sender, eventInfo) =>
            {
                gameEngine.SpaceShipShootRightBlaster();
            };



            Initialize(gameEngine);

            //

            gameEngine.Run();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            IRenderer renderer = new ConsoleRenderer(WorldRows, WorldCols);
            IUserInterface keyboard = new KeyboardInterface();

            Engine gameEngine = new Engine(renderer, keyboard);

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

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

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

            keyboard.OnEnterPressed += (sender, eventInfo) =>
            {
                gameEngine.SpaceShipShootRocket();
            };

            keyboard.OnRPressed += (sender, eventInfo) =>
            {
                gameEngine.SpaceShipShootSuperRocket();
            };

            keyboard.OnZPressed += (sender, eventInfo) =>
            {
                gameEngine.SpaceShipShootLeftBlaster();
            };

            keyboard.OnXPressed += (sender, eventInfo) =>
            {
                gameEngine.SpaceShipShootRightBlaster();
            };

            Initialize(gameEngine);

            //

            gameEngine.Run();
        }