optimise instance access
This commit is contained in:
@@ -13,18 +13,7 @@ namespace EscapeRoomEngine.Engine.Runtime
|
||||
public class Engine : MonoBehaviour
|
||||
{
|
||||
public static EngineTheme Theme => Instance.theme;
|
||||
public static Engine Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_foundEngine == null)
|
||||
{
|
||||
_foundEngine = FindObjectOfType<Engine>();
|
||||
}
|
||||
return _foundEngine;
|
||||
}
|
||||
}
|
||||
private static Engine _foundEngine;
|
||||
public static Engine Instance { get; private set; }
|
||||
|
||||
public delegate void UpdateUIHandler();
|
||||
public event UpdateUIHandler UpdateUIEvent;
|
||||
@@ -45,6 +34,8 @@ namespace EscapeRoomEngine.Engine.Runtime
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
Measure.Clear();
|
||||
|
||||
_puzzles = new List<PuzzleModuleDescription>(theme.puzzleTypes);
|
||||
@@ -57,6 +48,8 @@ namespace EscapeRoomEngine.Engine.Runtime
|
||||
_playSpaceOrigin.transform.localPosition = new Vector3(-theme.playSpace.x / 2f, 0, -theme.playSpace.y / 2f);
|
||||
}
|
||||
|
||||
#region Generation
|
||||
|
||||
public void GenerateRoom()
|
||||
{
|
||||
Logger.Log("Generating room...", LogType.RoomGeneration);
|
||||
@@ -123,6 +116,8 @@ namespace EscapeRoomEngine.Engine.Runtime
|
||||
room.AddSpace(space, exit);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void HidePreviousRoom(bool destroy = true)
|
||||
{
|
||||
if (NumberOfRooms > 2)
|
||||
|
||||
Reference in New Issue
Block a user