コード例 #1
0
ファイル: Pacman.cs プロジェクト: vitpunch/pacman
        private void GoCell()
        {
            if (x == 1 && direction == Direction.left)
            {
                Labirint.PrintArroundDot(x, y);
                x = 28;
            }

            if (x == 26 && direction == Direction.right)
            {
                Labirint.PrintArroundDot(x, y);
                x = 1;
            }
            switch (direction)
            {
            case Direction.right:
                x++;
                break;

            case Direction.left:
                x--;
                break;

            case Direction.up:
                y--;
                break;

            case Direction.down:
                y++;
                break;

            case Direction.stop:
                break;
            }
            if (Labirint.MayPassToDot(x, y, newDirection))
            {
                direction = newDirection;
            }
            else
            if (!Labirint.MayPassToDot(x, y, direction))
            {
                direction = Direction.stop;
            }
            if (Labirint.GetDot(x, y) == '.')
            {
                Labirint.SetEmpty(x, y);
                eatedDots++;
            }
        }