예제 #1
0
        public void HandleInput(KeyEventArgs e)
        {
            if (PlayerSnake == null)
            {
                return;
            }

            switch (e.KeyCode)
            {
            case Keys.W:
                PlayerSnake.ChangeDirection(Direction.Up);
                break;

            case Keys.D:
                PlayerSnake.ChangeDirection(Direction.Right);
                break;

            case Keys.S:
                PlayerSnake.ChangeDirection(Direction.Down);
                break;

            case Keys.A:
                PlayerSnake.ChangeDirection(Direction.Left);
                break;
            }
        }