Exemplo n.º 1
0
    public void LoadBaseLevel()
    {
        loading = true;
        MazeRoom         mainRoom    = new MazeRoom(new Rect(5, 5, 11, 11));
        LevelDepthConfig depthConfig = generalLevelConfig.GetLevelDepthConfiguration(-1);
        LevelConfig      levelConfig = Resources.Load <LevelConfig>("LevelConfigs/base");

        levelConfig.Randomize();

        MapGenerator.Initialize(levelConfig, depthConfig, ReadyWithBase);
        //MazeCarver carver = mapGenerator.InitializeCarver(worldRect, mapGenerator, levelConfig, depthConfig);
        MazeCarver carver = MapGenerator.InitializeCarver();

        MapGenerator.PlaceRoom(mainRoom);
        carver.FillWithHallway();
        //carver.RemoveFalseWalls();
        carver.Create3DWalls();
        carver.CreateNavMeshes();
        mapPopulator = MapGenerator.InitializeMapPopulator();
        //mapPopulator.SpawnKeyAt(mapGenerator.GetScaled(new Vector3(10, 10, 0)));

        SpawnWandAt(new Vector3(9, 9, 0), depthConfig.PowerLevel);
        SpawnWandAt(new Vector3(7, 9, 0), depthConfig.PowerLevel);
        SpawnWandAt(new Vector3(9, 7, 0), depthConfig.PowerLevel);
        Dummy dummyPrefab = Resources.Load <Dummy>("Dummy");

        Dummy dummy = Instantiate(dummyPrefab, MapGenerator.transform);

        dummy.transform.position = MapGenerator.GetScaled(new Vector3(13, 13, 0));

        mapPopulator.SpawnEndAt(MapGenerator.GetScaled(new Vector3(10, 10, 0)));
        player = mapPopulator.SpawnPlayerAt(MapGenerator.GetScaled(new Vector3(7, 7, 0)));
        mapPopulator.SetUpCamera(player);
        //fullscreenFade.FadeOut(ReadyWithBase);
    }
Exemplo n.º 2
0
 public void Initialize(LevelConfig levelConfig, LevelDepthConfig levelDepthConfig, GenerationComplete callback)
 {
     completeCallback   = callback;
     depthConfig        = levelDepthConfig;
     config             = levelConfig;
     mapPopulatorPrefab = Resources.Load <MapPopulator>("MapPopulator");
     world = new Rect(0, 0, config.Width, config.Height);
     rooms = new List <MazeRoom>();
     Debug.Log("Creating world with size: " + config.Width + ", " + config.Height);
 }
Exemplo n.º 3
0
 public void Initialize(MapGenerator mapGenerator, LevelDepthConfig levelDepthConfig)
 {
     this.mapGenerator = mapGenerator;
     depthConfig       = levelDepthConfig;
     meleeCreepPrefab  = Resources.Load <Meleeer>("MeleeEnemy");
     rangeCreepPrefab  = Resources.Load <Ranger>("RangeEnemy");
     keyPrefab         = Resources.Load <Key>("Key");
     mapGenerator.HideWorldSprite();
     mapGenerator.Rooms.ForEach(room => room.HideImage());
     GameObject ui = GameObject.FindGameObjectWithTag("UI");
     //ui.SetActive(true);
 }
Exemplo n.º 4
0
    public void LoadLevel()
    {
        LevelConfig config = GetLevelConfig();

        if (config == null)
        {
            GetMenu().ShowEnd(
                "The end.\nZarguuf defeated all his apprentices and continued on with his Saturday morning."
                );
            return;
        }
        LevelDepthConfig depthConfig = generalLevelConfig.GetLevelDepthConfiguration(levelNumber - 1);

        config.Randomize();
        LootManager.main.SetConfig(depthConfig);
        MapGenerator.Initialize(config, depthConfig, AfterLevelIsLoaded);
        MapGenerator.CreateWorld();
        levelNumber += 1;
    }
Exemplo n.º 5
0
 public void Initialize(Rect world, MapGenerator mapGen, LevelConfig levelConfig, LevelDepthConfig levelDepthConfig)
 {
     config      = levelConfig;
     depthConfig = levelDepthConfig;
     if (wallPrefab == null)
     {
         wallPrefab = (GameObject)Resources.Load("Wall");
     }
     mapGenerator = mapGen;
     nodes        = new MazeNode[config.Height][];
     for (int y = 0; y < config.Height; y += 1)
     {
         nodes[y] = new MazeNode[config.Width];
         for (int x = 0; x < config.Width; x += 1)
         {
             nodes[y][x] = null;
         }
     }
     worldRect = world;
 }
Exemplo n.º 6
0
 public void SetConfig(LevelDepthConfig levelDepthConfig)
 {
     depthConfig = levelDepthConfig;
     LoadPrefabs();
 }