Game_CodeMM/Assets/00_scripts/Events/TurnScripts/TurnManagerSingleton.cs
2025-11-20 20:02:48 +08:00

36 lines
1.2 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TurnManagerSingleton : MonoBehaviour
{
public static TurnManagerSingleton Instance { get; private set; }
[SerializeField] private TurnManager turnManager;
[SerializeField] private bool needDebugLog = true;
private void Awake()
{
if (Instance != null && Instance != this) Destroy(gameObject);
Instance = this;
DontDestroyOnLoad(gameObject);
if (turnManager == null) turnManager = GetComponent<TurnManager>();
}
// public void SetDebugLog(bool value) => needDebugLog = value;
public bool GetNeedDebugLog() => needDebugLog;
public bool GetValueIsNotNull(object value, string errorMessage)
{
if (value != null) return true;
Debug.LogError($"[传值为空]: Variable => [{errorMessage}], Type => [{typeof(object)}]");
return false;
}
public bool CompareManagerState(TurnManagerStateEnum srcState, TurnManagerStateEnum targetState)
{
if (srcState == targetState) return true;
Debug.LogError($"[流程验证失败]系统正在执行其他流程: {srcState}, 期望流程: {targetState}");
return false;
}
}