Last active
March 3, 2024 14:41
-
-
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.
This file contains hidden or 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