using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; namespace Beyond { public class CountdownTrigger : QuestTriggerBase { public int m_numTiggers = 3; // Start is called before the first frame update public UnityEvent m_onCorrect; public float m_onDelay = 0f; public bool m_useOnce = true; public ActionResponse m_actionResponse; void Start() { } IEnumerator Counted() { if (m_onDelay > 0f) yield return new WaitForSeconds(m_onDelay); m_onCorrect?.Invoke(); } public void OnAction() { m_numTiggers--; if (m_numTiggers == 0) { StartCoroutine(Counted()); OnActionResponse(m_actionResponse); if (m_useOnce) enabled = false; } } } }