CD-ROOM/Assets/Scripts/Player/DungeonIntruder.cs
Gerard Gascón 341a877b4a init
2025-04-24 17:37:25 +02:00

24 lines
590 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class DungeonIntruder : MonoBehaviour
{
public Room currentRoom;
public UnityEvent roomChange;
private void Awake()
{
roomChange = new UnityEvent();
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.GetComponent<Room>() != null && other.gameObject.GetComponent<Room>()!=currentRoom)
{
currentRoom = other.gameObject.GetComponent<Room>();
roomChange.Invoke();
}
}
}