private void LayoutDungeon(ref DFLocation location, bool importEnemies = true) { #if SHOW_LAYOUT_TIMES // Start timing System.Diagnostics.Stopwatch stopwatch = System.Diagnostics.Stopwatch.StartNew(); long startTime = stopwatch.ElapsedMilliseconds; #endif // Get player level - use level 1 if game not running (e.g. importing in editor mode) float playerLevel = 1; if (Application.isPlaying) { playerLevel = GameManager.Instance.PlayerEntity.Level; } // Calculate monster power - this is a clamped 0-1 value based on player's level from 1-20 float monsterPower = Mathf.Clamp01(playerLevel / 20f); // Create dungeon layout for (int i = 0; i < summary.LocationData.Dungeon.Blocks.Length; i++) { DFLocation.DungeonBlock block = summary.LocationData.Dungeon.Blocks[i]; GameObject go = GameObjectHelper.CreateRDBBlockGameObject( block.BlockName, DungeonTextureTable, block.IsStartingBlock, Summary.DungeonType, monsterPower, RandomMonsterVariance, (int)DateTime.Now.Ticks /*Summary.ID*/, // TODO: Add more options for seed dfUnity.Option_DungeonBlockPrefab, importEnemies); go.transform.parent = this.transform; go.transform.position = new Vector3(block.X * RDBLayout.RDBSide, 0, block.Z * RDBLayout.RDBSide); DaggerfallRDBBlock daggerfallBlock = go.GetComponent <DaggerfallRDBBlock>(); if (block.IsStartingBlock) { FindMarkers(daggerfallBlock, ref block, true); // Assign start marker and enter marker } else { FindMarkers(daggerfallBlock, ref block, false); // Only find water level and palaceblock info from start marker } summary.LocationData.Dungeon.Blocks[i].WaterLevel = block.WaterLevel; summary.LocationData.Dungeon.Blocks[i].CastleBlock = block.CastleBlock; // Add water blocks RDBLayout.AddWater(go, go.transform.position, block.WaterLevel); } RemoveOverlappingDoors(); #if SHOW_LAYOUT_TIMES // Show timer long totalTime = stopwatch.ElapsedMilliseconds - startTime; DaggerfallUnity.LogMessage(string.Format("Time to layout dungeon: {0}ms", totalTime), true); #endif }
// Orsinium defines two blocks at [-1,-1] private void LayoutOrsinium(ref DFLocation location, bool importEnemies = true) { // Calculate monster power - this is a clamped 0-1 value based on player's level from 1-20 float monsterPower = Mathf.Clamp01(GameManager.Instance.PlayerEntity.Level / 20f); // Create dungeon layout and handle misplaced block for (int i = 0; i < summary.LocationData.Dungeon.Blocks.Length; i++) { DFLocation.DungeonBlock block = summary.LocationData.Dungeon.Blocks[i]; if (block.X == -1 && block.Z == -1 && block.BlockName == "N0000065.RDB") { continue; } GameObject go = GameObjectHelper.CreateRDBBlockGameObject( block.BlockName, DungeonTextureTable, block.IsStartingBlock, Summary.DungeonType, monsterPower, RandomMonsterVariance, (int)DateTime.Now.Ticks /*Summary.ID*/, // TODO: Add more options for seed dfUnity.Option_DungeonBlockPrefab, importEnemies); go.transform.parent = this.transform; go.transform.position = new Vector3(block.X * RDBLayout.RDBSide, 0, block.Z * RDBLayout.RDBSide); DaggerfallRDBBlock daggerfallBlock = go.GetComponent <DaggerfallRDBBlock>(); if (block.IsStartingBlock) { FindMarkers(daggerfallBlock, ref block, true); // Assign start marker and enter marker } else { FindMarkers(daggerfallBlock, ref block, false); // Only find water level and castle block info from start marker } summary.LocationData.Dungeon.Blocks[i].WaterLevel = block.WaterLevel; summary.LocationData.Dungeon.Blocks[i].CastleBlock = block.CastleBlock; // Add water blocks RDBLayout.AddWater(go, go.transform.position, block.WaterLevel); } RemoveOverlappingDoors(); }