/// <summary> /// Layout a complete RDB block game object. /// </summary> /// <param name="blockName">Name of block to create.</param> /// <param name="textureTable">Optional texture table for dungeon.</param> /// <param name="allowExitDoors">Add exit doors to block (for start blocks).</param> /// <param name="dungeonType">Dungeon type for random encounters.</param> /// <param name="seed">Seed for random encounters.</param> /// <param name="cloneFrom">Clone and build on a prefab object template.</param> public static GameObject CreateRDBBlockGameObject( string blockName, int[] textureTable = null, bool allowExitDoors = true, DFRegion.DungeonTypes dungeonType = DFRegion.DungeonTypes.HumanStronghold, float monsterPower = 0.5f, int monsterVariance = 4, int seed = 0, DaggerfallRDBBlock cloneFrom = null) { // Get DaggerfallUnity DaggerfallUnity dfUnity = DaggerfallUnity.Instance; if (!dfUnity.IsReady) { return(null); } Dictionary <int, RDBLayout.ActionLink> actionLinkDict = new Dictionary <int, RDBLayout.ActionLink>(); // Create base object DFBlock blockData; GameObject go = RDBLayout.CreateBaseGameObject(blockName, actionLinkDict, out blockData, textureTable, allowExitDoors, cloneFrom); // Add action doors RDBLayout.AddActionDoors(go, actionLinkDict, ref blockData, textureTable); // Add lights RDBLayout.AddLights(go, ref blockData); // Add flats DFBlock.RdbObject[] editorObjects; GameObject[] startMarkers; GameObject[] enterMarkers; RDBLayout.AddFlats(go, actionLinkDict, ref blockData, out editorObjects, out startMarkers, out enterMarkers); // Set start and enter markers DaggerfallRDBBlock dfBlock = go.GetComponent <DaggerfallRDBBlock>(); if (dfBlock != null) { dfBlock.SetMarkers(startMarkers, enterMarkers); } // Add treasure RDBLayout.AddTreasure(go, editorObjects, ref blockData); // Add enemies RDBLayout.AddFixedEnemies(go, editorObjects, ref blockData); RDBLayout.AddRandomEnemies(go, editorObjects, dungeonType, monsterPower, ref blockData, monsterVariance, seed); // Link action nodes RDBLayout.LinkActionNodes(actionLinkDict); return(go); }