Exemplo n.º 1
0
        static void Main(string[] args)
        {
            try
            {
                // The third command-line parameter indicates how many extra connections should be added to the labyrinth
                // once it is a single blob.  This will introduce cycles, which should make the labyrinth more challenging to navigate.
                var numberOfExtraConnections = 0;

                if (args.Length < 2 || args.Length > 3)
                {
                    Console.WriteLine("Usage: Labyrinth.exe (NumberOfLevels) (NumberOfRoomsPerLevel) [NumberOfExtraConnections]");
                    return;
                }

                if (args.Length > 2)
                {
                    numberOfExtraConnections = int.Parse(args[2]);
                }

                var generator = new LabyrinthGenerator(int.Parse(args[0]), int.Parse(args[1]), numberOfExtraConnections);

                generator.Generate();
                generator.Report();
                generator.PrintLongestPath();
                generator.NavigateLabyrinth();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Caught {0}: {1}", ex.GetType().FullName, ex.Message);
            }
        }
Exemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();
            LabyrinthGenerator labyrinthGenerator = (LabyrinthGenerator)target;

            labyrinthGenerator.rows =
                EditorGUILayout.IntSlider(labyrinthGenerator.rows, 10, 100);
            labyrinthGenerator.columns =
                EditorGUILayout.IntSlider(labyrinthGenerator.columns, 10, 100);
            var isPressButton = GUILayout.Button("Создать лабиринт",
                                                 EditorStyles.miniButtonLeft);

            if (isPressButton)
            {
                labyrinthGenerator.isNeedToGenerate = false;
                labyrinthGenerator.Generate();
            }
        }