89 lines
2.7 KiB
C#
89 lines
2.7 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using InfallibleCode;
|
||
using System;
|
||
|
||
[System.Serializable]
|
||
public class RoomTriggerPendingCategory
|
||
{
|
||
public string roomSceneName;
|
||
public int categoryIndex;
|
||
}
|
||
|
||
[System.Serializable]
|
||
public class RoomTriggersData
|
||
{
|
||
public List<string> newNearbyRoomSceneNames = new List<string>();
|
||
public string roomSceneName;
|
||
public int activeCategoryIndex = 0; // <-- ΝΕΟ για να θυμόμαστε ποιο category ήταν ενεργό
|
||
}
|
||
|
||
public class RoomManager : MonoBehaviour
|
||
{
|
||
|
||
private static RoomManager _instance;
|
||
|
||
public static RoomManager GetInstance() { return _instance; }
|
||
|
||
public int _roomID;
|
||
public List<ClosetHideBehaviour> closetHideBehaviour = new List<ClosetHideBehaviour>();
|
||
public List<BedHideBehaviourBase> bedHideBehaviour = new List<BedHideBehaviourBase>();
|
||
public RoomTrigger LastRoomTriggerPlayerEntered;
|
||
public List<Transform> _roomPatrolPoints = new List<Transform>();
|
||
|
||
public List<string> _nearbyRoomSceneNames = new List<string>();
|
||
public List<string> necessarySceneNamesToKeepLoaded = new List<string>();
|
||
|
||
//public List<string> additiveScenesLoaded;
|
||
|
||
//public List<Dictionary<string, List<string>>> roomConnections = new List<Dictionary<string, List<string>>>();
|
||
public List<RoomTriggersData> roomTriggersData = new List<RoomTriggersData>();
|
||
public List<RoomTriggerData> roomTriggersSnapshotData = new List<RoomTriggerData>();
|
||
public List<RoomTriggerPendingCategory> pendingCategoryChanges = new List<RoomTriggerPendingCategory>();
|
||
|
||
public List<RoomTrigger> activeRoomTriggers = new List<RoomTrigger>();
|
||
|
||
public event Action OnRoomsChanged = delegate { };
|
||
|
||
private void Awake()
|
||
{
|
||
if (_instance == null)
|
||
{
|
||
_instance = this;
|
||
DontDestroyOnLoad(gameObject); // This ensures the object persists across scene loads
|
||
}
|
||
else
|
||
{
|
||
Destroy(gameObject); // This prevents duplicate instances
|
||
}
|
||
}
|
||
//void Start()
|
||
|
||
public void RegisterRoomTrigger(RoomTrigger trigger)
|
||
{
|
||
if (!activeRoomTriggers.Contains(trigger))
|
||
{
|
||
activeRoomTriggers.Add(trigger);
|
||
}
|
||
}
|
||
|
||
public void UnregisterRoomTrigger(RoomTrigger trigger)
|
||
{
|
||
if (activeRoomTriggers.Contains(trigger))
|
||
{
|
||
activeRoomTriggers.Remove(trigger);
|
||
}
|
||
}
|
||
|
||
public void RoomsChanged()
|
||
{
|
||
OnRoomsChanged?.Invoke();
|
||
print("OnRoomsChanged EVENT");
|
||
}
|
||
//players hidding spot: method get players hidding spot -> returns transform
|
||
// hidding spots
|
||
//room patrol points: it doesnt have to do with if the player is hidden or not
|
||
|
||
}
|