示例#1
0
        public void HandleOnInputEvent(InputEvent e)
        {
            // logic that handles input will be implemented later"
            dirty_flag = true;

            PlayerAttemptMovementEvent potentialMove = new PlayerAttemptMovementEvent(x, y, x, y);

            //TODO Bound movement
            switch (e.key)
            {
            case 'w':
                Console.WriteLine("Player Up");
                potentialMove.destination_y++;
                break;

            case 's':
                Console.WriteLine("Player Down");
                potentialMove.destination_y--;
                break;

            case 'a':
                Console.WriteLine("Player Left");
                potentialMove.destination_x--;
                break;

            case 'd':
                Console.WriteLine("Player Right");
                potentialMove.destination_x++;
                break;

            default: break;
            }
            MessageBus.getInstance().AddEvent(potentialMove);
        }
示例#2
0
        public void HandlePlayerRequestMoveEvent(PlayerAttemptMovementEvent e)
        {
            // detect if player is requesting movement
            //check player id

            first_x = e.current_x;
            first_y = e.current_y;
            Console.WriteLine("Player is trying to move.");
        }