Forked from AG-Dan/DoSomethingOnDungeonComplete.cs
Last active
March 3, 2024 14:41
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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