Skip to content

Instantly share code, notes, and snippets.

@AG-Dan
Last active March 3, 2024 14:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save AG-Dan/a232adf0dae32ab4efe154f8dbd4c49a to your computer and use it in GitHub Desktop.
Save AG-Dan/a232adf0dae32ab4efe154f8dbd4c49a to your computer and use it in GitHub Desktop.
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()
{
runtimeDungeon = GetComponent<RuntimeDungeon>();
runtimeDungeon.Generator.OnGenerationStatusChanged += OnDungeonGenerationStatusChanged;
}
private void OnDestroy()
{
runtimeDungeon.Generator.OnGenerationStatusChanged -= OnDungeonGenerationStatusChanged;
}
private void OnDungeonGenerationStatusChanged(DungeonGenerator generator, GenerationStatus status)
{
if (status == GenerationStatus.Complete)
{
// Do something
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment