Skip to content

Instantly share code, notes, and snippets.

using DunGen;
using UnityEngine;
[RequireComponent(typeof(RuntimeDungeon))]
class PlayerSpawner : MonoBehaviour
{
public GameObject PlayerPrefab = null;
private GameObject currentPlayer;
private void AdjustSettingsAndGenerate(RuntimeDungeon runtimeDungeon)
{
var dungeonFlowAsset = runtimeDungeon.Generator.DungeonFlow;
// Make a copy of the existing settings
var newDungeonFlow = Instantiate(dungeonFlowAsset);
// Adjust the number of instances of the first global prop in the list
newDungeonFlow.GlobalProps[0].Count = new IntRange(1, 3);
using DunGen;
using System.Collections.Generic;
using UnityEngine;
sealed class InjectSpecialRoom : MonoBehaviour
{
public TileSet TileSet = null;
public bool Required = true;
public int CountMin = 1;
public int CountMax = 1;
private Doorway GetNextDoorwayClosestToEndTile(Tile currentTile)
{
// Loop through all active doorways for the tile we're currently in
foreach (var doorway in currentTile.Placement.UsedDoorways)
{
var adjacentTile = doorway.ConnectedDoorway.Tile; // Get the tile connected by this doorway
if (currentTile.Placement.IsOnMainPath)
{
// We're already on the main path
using DunGen;
using UnityEngine;
public sealed class AquireDungeonSeed : MonoBehaviour
{
public RuntimeDungeon RuntimeDungeon; // Set through the inspector
private void Awake()
{
@AG-Dan
AG-Dan / DoSomethingOnDungeonComplete.cs
Last active March 3, 2024 14:41
This script would be attached to the same object as our RuntimeDungeon component.
using UnityEngine;
using DunGen;
[RequireComponent(typeof(RuntimeDungeon))]
public class DoSomethingOnDungeonComplete : MonoBehaviour
{
private RuntimeDungeon runtimeDungeon;
private void Awake()
using UnityEngine;
using UnityEngine.AI;
namespace DunGen.Dev
{
[RequireComponent(typeof(NavMeshAgent))]
public class LinearOffMeshLinkTraverser : MonoBehaviour
{
private NavMeshAgent agent;
@AG-Dan
AG-Dan / BuildDungeonFlow.cs
Created November 15, 2016 15:39
Attempt at creating dungeon settings through code in DunGen 2.10
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using DunGen;
using System.Linq;
using DunGen.Graph;
public class BuildDungeonFlow : MonoBehaviour
{
public List<GameObject> RoomPrefabs = new List<GameObject>();