Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gekidoslair/34426b0be889a41c546a0592601c1357 to your computer and use it in GitHub Desktop.
Save gekidoslair/34426b0be889a41c546a0592601c1357 to your computer and use it in GitHub Desktop.
Listener script for DunGen: 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