コード例 #1
0
ファイル: Program.cs プロジェクト: azb101/design-patterns
        static void Main(string[] args)
        {
            MazeGame game          = new MazeGame();
            var      simpleFactory = new MazePrototypeFactory(new Maze(), new Room(), new Door(), new Wall());
            var      maze          = game.CreateGame(simpleFactory);


            var bombedFactory = new MazePrototypeFactory(new Maze(), new Room(), new Door(), new BombedWall());
            var anotherMaze   = game.CreateGame(bombedFactory);
        }
コード例 #2
0
        private void CreateGame()
        {
            Maze                 maze;
            MazeGame             game = new MazeGame();
            MazePrototypeFactory simpleMazeFactory = new MazePrototypeFactory(new Maze(), new Room(0), new Wall(), new Door());

            MazePrototypeFactory bombedMazeFactory = new MazePrototypeFactory(new Maze(), new RoomWithABomb(1), new BombedWall(), new Door());

            maze = game.CreateMaze(simpleMazeFactory);
        }