Exemple #1
0
 public static MazeFactory Instance()
 {
     if (_instance == null)
     {
         _instance = new MazeFactory();
     }
     return(_instance);
 }
Exemple #2
0
        public static MazeFactory InstanceWithSubclasses(string mazeStyle)
        {
            if (_instance == null)
            {
                switch (mazeStyle)
                {
                case "bombed":
                    _instance = new BombedMazeFactory();
                    break;

                case "enchanted":
                    _instance = new EnchantedMazeFactory();
                    break;

                default:
                    _instance = new MazeFactory();
                    break;
                }
            }
            return(_instance);
        }