connect multiple rooms with doors

This commit is contained in:
2022-11-03 21:20:00 +01:00
parent bce88d0504
commit 807eae1c62
24 changed files with 391 additions and 88 deletions

View File

@@ -0,0 +1,37 @@
using System.Collections.Generic;
using UnityEngine;
namespace Escape_Room_Engine.Engine.Scripts.Utilities
{
public enum LogType
{
Important, ModulePlacement, PassageConnection, RoomGeneration
}
public class Logger : MonoBehaviour
{
public static Logger DefaultLogger
{
get
{
if (_foundLogger == null)
{
_foundLogger = FindObjectOfType<Logger>();
}
return _foundLogger;
}
}
private static Logger _foundLogger;
public bool loggingEnabled;
public List<LogType> typeFilter;
public static void Log(string message, LogType type = LogType.Important)
{
if (DefaultLogger.loggingEnabled && DefaultLogger.typeFilter.Contains(type))
{
Debug.Log($"<b>[{type}]</b> {message}");
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: debf8d65bda642bc938a94c7639e01a4
timeCreated: 1667815421

View File

@@ -0,0 +1,23 @@
using UnityEngine;
namespace Escape_Room_Engine.Engine.Scripts.Utilities
{
public static class Utilities
{
#region Math
public static int RandomInclusive(int from, int to) => Random.Range(from, to + 1);
/// <summary>
/// Returns whether a position relative to some dimensions is inside those dimensions.
/// </summary>
/// <param name="position">The position to check, relative to the dimensions.</param>
/// <param name="dimensions">The dimensions to check the position against.</param>
public static bool IsInsideRelative(this Vector2Int position, Dimensions dimensions)
{
return position.x >= 0 && position.y >= 0 && position.x < dimensions.width && position.y < dimensions.length;
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 092cc048ba0e4bb7a7862083fb702884
timeCreated: 1667812284