예제 #1
0
        static void Main(string[] args)
        {
            MazePrototypeFactory mpf = new MazePrototypeFactory(new Maze(5, 5), new CoinRoom(), new Wall());
            Maze m = createMaze(mpf);

            m.printMaze();
            Console.ReadLine();
        }
예제 #2
0
        public static Maze createMaze(MazePrototypeFactory mpf)
        {
            Maze m = mpf.makeMaze();

            for (int x = 0; x < 5; x++)
            {
                for (int y = 0; y < 5; y++)
                {
                    m.addComponent(mpf.makeWall(), x, y);
                }
            }

            m.addComponent(mpf.makeRoom(), 1, 2);
            m.addComponent(mpf.makeRoom(), 2, 2);
            m.addComponent(mpf.makeRoom(), 3, 2);
            m.addComponent(mpf.makeRoom(), 1, 1);
            m.addComponent(mpf.makeRoom(), 3, 1);
            m.addComponent(mpf.makeRoom(), 1, 3);
            m.addComponent(mpf.makeRoom(), 3, 3);

            return(m);
        }