Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        running  = true;
        maker    = GetComponent <MazeMaker>();
        maker.gc = this;
        maker.makeMaze(35, 35);
        enemies = new GameObject[10];
        player.GetComponent <Player>().maker = maker;
        player.GetComponent <Player>().gc    = this;

        for (int i = 0; i < 10; i++)
        {
            Destroy(enemies[i]);
            int posr = 0;
            int posc = 0;
            do
            {
                posr = Random.Range(2, maker.data.GetUpperBound(1) - 2);
                posc = Random.Range(2, maker.data.GetUpperBound(1) - 2);
            } while (maker.data[posr, posc] == 1);
            Vector3 pos = new Vector3(posc * maker.width, 0.5f, posr * maker.width);
            enemies[i]      = (GameObject)Instantiate <GameObject>(en, pos, Quaternion.identity);
            enemies[i].name = "Skel" + i.ToString();
            enemies[i].GetComponent <Enemy>().maker  = maker;
            enemies[i].GetComponent <Enemy>().player = player;
            enemies[i].GetComponent <Enemy>().gc     = this;
            enemies[i].GetComponent <Enemy>().self   = enemies[i];
        }
    }
Example #2
0
    public void StartProcess()
    {
        DestroyMaze();
        player.transform.position = new Vector3(0, 0, 0);
        InitializeMaze();
        MazeAlgorithm ma = new MazeMaker(mazeCells);

        ma.CreateMaze();
    }
Example #3
0
 // END CUT HERE
 // BEGIN CUT HERE
 public static void Main()
 {
     try {
     MazeMaker ___test = new MazeMaker();
     ___test.run_test(-1);
     } catch(Exception e) {
     //Console.WriteLine(e.StackTrace);
     Console.WriteLine(e.ToString());
     }
 }
Example #4
0
// END CUT HERE
// BEGIN CUT HERE
    public static void Main()
    {
        try {
            MazeMaker ___test = new MazeMaker();
            ___test.run_test(-1);
        } catch (Exception e) {
//Console.WriteLine(e.StackTrace);
            Console.WriteLine(e.ToString());
        }
    }
Example #5
0
    // Start is called before the first frame update
    void Awake()
    {
        instance     = this;
        neighborList = new Dictionary <Vector2, HashSet <Vector2> >();

        PRNG.ForceSeed(seed);
        enemyCount = PRNG.Range(10, 15);
        lootCount  = PRNG.Range(5, 10);
        GenerateMaze();
        DeformMaze(4 * width, 5 * width * height, 10 * width * height);

        // PrintMinesweeper();
    }
Example #6
0
        public void place_bombs()
        {
            var map = MazeMaker.create(get_counts().x, get_counts().y, free_space_amount);

            map[start.x, start.y] = false;
            map[goal.x, goal.y]   = false;

            // Just bruteforce 100% solveable levels!
            while (!AStar.solvable(map, start, goal))
            {
                map = MazeMaker.create(get_counts().x, get_counts().y, free_space_amount);
                map[start.x, start.y] = false;
                map[goal.x, goal.y]   = false;
            }
            for (int x = 0; x < map.GetLength(0); x++)
            {
                for (int y = 0; y < map.GetLength(1); y++)
                {
                    set_bomb(x, y, map[x, y]);
                }
            }
        }