Ejemplo n.º 1
0
 // Start the dungeon by saving game and loading the Dungeon scene
 public void StartDungeon(PlayerHUD.DungeonParameters _DungeonParametersSelected)
 {
     _CurDungeonParameters = _DungeonParametersSelected;
     SaveLoadSystem.Save();
     BuildSystem.CreatedBuildingList = new List<GameObject>(); // Todo: This probably need to go somewhere else
     Application.LoadLevel("Dungeon");
 }
Ejemplo n.º 2
0
    void Start()
    {
        Camera.mainCamera.GetComponent<Skybox>().material = GameObject.FindGameObjectWithTag("GameMaster").GetComponent<TextureManager>().Material_Skybox_Dungeon;
        _GameManager = GameObject.FindGameObjectWithTag("GameMaster").GetComponent<GameManager>();
        _GameManager.ChangeState("Play");

        // Find information about the dungeon to spawn
        _CurDungeonParameters = _GameManager.CurDungeonParameters;
        _curDungeonLevel = _CurDungeonParameters.level;

        // Find information about the level to spawn
        _mapSizeX = DungeonLevelPool.DungeonLevelList[_curDungeonLevel].SizeX;
        _mapSizeZ = DungeonLevelPool.DungeonLevelList[_curDungeonLevel].SizeY;
        _nbrOfSquareSpawned = DungeonLevelPool.DungeonLevelList[_curDungeonLevel].NbrSquareForSpawn;
        _monsterToSpawn     = DungeonLevelPool.DungeonLevelList[_curDungeonLevel].MonsterList;

        // Initialize Dungeon
        IniDungeon(_mapSizeX, _mapSizeZ);

        // Spawn Dungeon
        _dungeonMap = DungeonGenerator.SpawnDungeon(_mapSizeX,_mapSizeZ,_nbrOfSquareSpawned,_CurDungeonParameters);

        // Initialize P_Pathfinding and Player
        IniPathfindGraph(_mapSizeX, _mapSizeZ);
        IniPlayer(_dungeonMap, _mapSizeX, _mapSizeZ);

        //Spawn all monster for the level
        SpawnAllMonster(_monsterToSpawn, _dungeonMap, _mapSizeX,_mapSizeZ);

        // Finalize the dungeon iniatiliation
        _GameManager.CurZone = DungeonLevelPool.DungeonLevelList[_curDungeonLevel].Name;
        _isDungeonStarted = true;
        GameObject.FindGameObjectWithTag("PlayerMaster").GetComponent<PlayerHUD>().InitializeMap(_dungeonMap, _mapSizeX, _mapSizeZ);
    }