public bool TriggerGlobal(string key) { if (!GlobalTriggers.TryGetValue(key, out var trigger)) { return(false); } if (!trigger.Trigger()) { #if UNITY_EDITOR if (trigger.Triggered) { TriggerLog.Add(key + " Already triggered"); } else { TriggerLog.Add(key + "next valid time " + (trigger.TimeTriggered + trigger.MinTriggerTime).ToString("F2") + " Current " + TimeManager.Time.ToString("F2")); } #endif return(false); } for (int i = 0; i < _globals.Count; i++) { _globals[i].CheckConditions(); } if (Current != null && Current.CanExit()) { var node = Current.GetExitNode(); if (node != null) { SetCurrentNode(node); } } trigger.Reset(); #if UNITY_EDITOR TriggerLog.Add(key); #endif return(true); }
public bool IsGlobalTriggerActive(string key) { return(GlobalTriggers.TryGetValue(key, out var trigger) && trigger.Triggered); }