summaryrefslogtreecommitdiff
path: root/WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs')
-rw-r--r--WorldlineKeepers/Assets/Scripts/Tools/FlagManager.cs44
1 files changed, 44 insertions, 0 deletions
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
+{
+
+ /// <summary>
+ /// 全局标志管理
+ /// </summary>
+ public class FlagManager : Singleton<FlagManager>
+ {
+ public Dictionary<string, bool> 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);
+ }
+ }
+
+ }
+
+}