using System.Collections.Generic; using _Project.Scripts.PlayerUtils; using UnityEngine; namespace _Project.Scripts.LevelGenerating { public class RoomView : MonoBehaviour { public Room Data; public int Index; public float Height; public readonly List FloorRenderers = new List(); public readonly List CeilingRenderers = new List(); public readonly List WallRenderers = new List(); public readonly List Doors = new List(); public readonly List Enemies = new List(); public List BakedLightmaps = new List(); public Vector3 OriginMeters => new Vector3(Data.Position.x * LevelGrid.Module, 0f, Data.Position.y * LevelGrid.Module); public Vector3 SizeMeters => new Vector3(Data.Length * LevelGrid.Module, Height, Data.Width * LevelGrid.Module); public Vector3 CenterMeters => OriginMeters + new Vector3(SizeMeters.x / 2f, 0f, SizeMeters.z / 2f); private void OnDestroy() { foreach (var rt in BakedLightmaps) { if (rt != null) { rt.Release(); Destroy(rt); } } BakedLightmaps.Clear(); } } }