void BuildDungeon() { // Make sure we have a theme defined Dungeon dungeon = target as Dungeon; if (dungeon != null) { if (HasValidThemes(dungeon)) { // Create the splat maps for this dungeon, if necessary var splatComponent = dungeon.GetComponent <DungeonSplatmap>(); SplatmapPropertyEditor.CreateSplatMapAsset(splatComponent); // Build the dungeon Undo.RecordObjects(new Object[] { dungeon, dungeon.ActiveModel }, "Dungeon Built"); dungeon.Build(new EditorDungeonSceneObjectInstantiator()); DungeonEditorHelper.MarkSceneDirty(); // Mark the splatmaps as dirty if (splatComponent != null && splatComponent.splatmap != null) { EditorUtility.SetDirty(splatComponent.splatmap); } } else { Highlighter.Highlight("Inspector", "Dungeon Themes"); // Notify the user that atleast one theme needs to be set EditorUtility.DisplayDialog("Dungeon Architect", "Please assign atleast one Dungeon Theme before building", "Ok"); } } }
IEnumerator BuildDungeon(Dungeon dungeon) { dungeon.DestroyDungeon(); yield return(0); dungeon.Build(); yield return(0); InstantiatePlayer(); yield return(0); InstantiateGoal(); yield return(0); game_start = true; yield return(new WaitForSeconds(1)); while (!on_enemy) { InstantiateEnemy(); } }
IEnumerator RebuildLevelRoutine() { SetLoadingTextVisible(true); loadingText.text = ""; AppendLoadingText("Generating Level... "); dungeon.DestroyDungeon(); NotifyDestroyed(); yield return(0); dungeon.Build(); yield return(0); NotifyBuild(); yield return(0); AppendLoadingText("DONE!\n"); AppendLoadingText("Building Navigation... "); yield return(0); // Wait for a frame to show our loading text RebuildNavigation(); AppendLoadingText("DONE!\n"); AppendLoadingText("Spawning NPCs..."); yield return(0); // Wait for a frame to show our loading text npcSpawner.RebuildNPCs(); AppendLoadingText("DONE!\n"); SetLoadingTextVisible(false); yield return(null); }
IEnumerator RebuildLevel(Dungeon dungeon) { textBuildingNavMesh.gameObject.SetActive(false); levelLoadingScreen.SetActive(true); if (minimap != null) { minimap.SetActive(false); } textBuildingLayout.text = labelBuildingLayout; textBuildingLayout.gameObject.SetActive(true); yield return(0); dungeon.DestroyDungeon(); yield return(0); dungeon.Build(); textBuildingLayout.text = labelBuildingLayout + "DONE!"; textBuildingNavMesh.text = labelBuildingNavmesh; textBuildingNavMesh.gameObject.SetActive(true); yield return(0); npcSpawner.OnPostDungeonBuild(dungeon, dungeon.ActiveModel); levelLoadingScreen.SetActive(false); if (minimap != null) { minimap.SetActive(true); } // reset player health var player = GameObject.FindGameObjectWithTag(GameTags.Player); if (player != null) { var health = player.GetComponent <PlayerHealth>(); if (health != null) { health.currentHealth = health.startingHealth; } } // Destroy any npc too close to the player var enemyControllers = GameObject.FindObjectsOfType <AIController>(); var playerPosition = player.transform.position; foreach (var enemyController in enemyControllers) { var enemy = enemyController.gameObject; var distance = (playerPosition - enemy.transform.position).magnitude; if (distance < 1) { Destroy(enemy); } } }
// Use this for initialization void Awake() { dungeon.Config.Seed = (uint)Random.Range(0, 100000); dungeon.Build(); TeleportToValidPlatform(player); foreach (var npc in npcs) { TeleportToValidPlatform(npc); } }
void Start() { if (dungeon != null) { // Requires a rebuild for now as the state is not fully saved (data in hash sets is not serialized properly) dungeon.Build(); gridModel = dungeon.GetComponent <GridDungeonModel>(); } // Setup materials materialCursor = CreateMaterial(Color.white); materialCorridors = CreateMaterial(Color.yellow); materialRooms = CreateMaterial(Color.red); }
IEnumerator RebuildLevel(Dungeon dungeon) { textBuildingNavMesh.gameObject.SetActive(false); levelLoadingScreen.SetActive(true); minimap.SetActive(false); textBuildingLayout.text = labelBuildingLayout; textBuildingLayout.gameObject.SetActive(true); yield return 0; dungeon.DestroyDungeon(); yield return 0; dungeon.Build(); textBuildingLayout.text = labelBuildingLayout + "DONE!"; textBuildingNavMesh.text = labelBuildingNavmesh; textBuildingNavMesh.gameObject.SetActive(true); yield return 0; RebuildNavigation(); npcSpawner.OnPostDungeonBuild(dungeon, dungeon.ActiveModel); levelLoadingScreen.SetActive(false); minimap.SetActive(true); // reset player health var player = GameObject.FindGameObjectWithTag(GameTags.Player); if (player != null) { var health = player.GetComponent<PlayerHealth>(); if (health != null) { health.currentHealth = health.startingHealth; } } // Destroy any npc too close to the player var enemyControllers = GameObject.FindObjectsOfType<AIController>(); var playerPosition = player.transform.position; foreach (var enemyController in enemyControllers) { var enemy = enemyController.gameObject; var distance = (playerPosition - enemy.transform.position).magnitude; if (distance < 1) { Destroy (enemy); } } }
public override bool InstantExecute(GameObject target, IAction[] actions, int index) { if (dungeon != null) { if (RandomSeed) { GFDungeonConfig.Seed = (uint)Random.Range(MinVal, MaxVal); } else { GFDungeonConfig.Seed = FixedSeed; } dungeon.Build(); } return(true); }
void BuildDungeon() { // Make sure we have a theme defined Dungeon dungeon = target as Dungeon; if (dungeon != null) { if (HasValidThemes(dungeon)) { // Build the dungeon dungeon.Build(); } else { Highlighter.Highlight("Inspector", "Dungeon Themes"); // Notify the user that atleast one theme needs to be set EditorUtility.DisplayDialog("Dungeon Architect", "Please assign atleast one Dungeon Theme before building", "Ok"); } } }
// Use this for initialization public void BuildMiniMap(Dungeon baseDungeon) { if (miniMapDungeonObject == null) { miniMapDungeonObject = Instantiate(baseDungeon.gameObject); } // Move the mini-map dungeon down minimapDungeon = miniMapDungeonObject.GetComponent <Dungeon>(); minimapDungeon.transform.position = gameObject.transform.position; // Disable unwanted components from the cloned minimap dungeon DisableComponent <WaypointGenerator>(miniMapDungeonObject); DisableComponent <LevelNpcSpawner>(miniMapDungeonObject); DisableComponent <SpecialRoomFinder>(miniMapDungeonObject); DisableComponent <MiniMapRebuilder>(miniMapDungeonObject); // Apply the mini-map themes and rebuild minimapDungeon.dungeonThemes = miniMapThemes; minimapDungeon.Config.Seed = baseDungeon.Config.Seed; minimapDungeon.Build(); }
void BuildDungeon() { // Make sure we have a theme defined Dungeon dungeon = target as Dungeon; if (dungeon != null) { if (HasValidThemes(dungeon)) { // Build the dungeon Undo.RecordObjects(new Object[] { dungeon, dungeon.ActiveModel }, "Dungeon Built"); dungeon.Build(); DungeonEditorHelper.MarkSceneDirty(); } else { Highlighter.Highlight("Inspector", "Dungeon Themes"); // Notify the user that atleast one theme needs to be set EditorUtility.DisplayDialog("Dungeon Architect", "Please assign atleast one Dungeon Theme before building", "Ok"); } } }
IEnumerator RebuildDungeon() { if (dungeon != null) { if (performCleanRebuild) { // We want to remove design time data with a clean destroy since editor would allow modification of optimized static game objects // We want to do this only for the first time dungeon.DestroyDungeon(); performCleanRebuild = false; // Wait for 1 frame to make sure our design time objects were destroyed yield return(0); } // Build the dungeon var config = dungeon.Config; if (config != null) { config.Seed = (uint)(Random.value * uint.MaxValue); dungeon.Build(); } } }
public void BuildDungeon() { _generator.Build(); isEnableDungeon = true; }