From 3b036c6de871aa519a1f7fbfb52e09618945041f Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Mon, 15 May 2023 09:28:11 +0800 Subject: *misc --- .../Assets/Scripts/Tools/FlagManager.cs | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs (limited to 'WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs') diff --git a/WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs b/WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs new file mode 100644 index 0000000..b9a9454 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs @@ -0,0 +1,44 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace WK +{ + + /// + /// 全局标志管理 + /// + public class FlagManager : Singleton + { + public Dictionary m_Flags; + + public void AddFlag(string flag, bool value = false) + { + if(!HasFlag(flag)) + { + m_Flags.Add(flag, value); + } + } + + public bool HasFlag(string flag) + { + return m_Flags.ContainsKey(flag); + } + + public bool IsFlag(string flag) + { + if(m_Flags.ContainsKey(flag)) return false; + return m_Flags[flag]; + } + + public void RemoveFlag(string flag) + { + if(HasFlag(flag)) + { + m_Flags.Remove(flag); + } + } + + } + +} -- cgit v1.1-26-g67d0