connect multiple rooms with doors
This commit is contained in:
37
Assets/Escape Room Engine/Engine/Scripts/Utilities/Logger.cs
Normal file
37
Assets/Escape Room Engine/Engine/Scripts/Utilities/Logger.cs
Normal 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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: debf8d65bda642bc938a94c7639e01a4
|
||||
timeCreated: 1667815421
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 092cc048ba0e4bb7a7862083fb702884
|
||||
timeCreated: 1667812284
|
||||
Reference in New Issue
Block a user