void OnClose(Unit u) { target_enemy.OnIdentify -= OnClose; StartCoroutine(M_Math.ExecuteDelayed(3f, () => ToastNotification.SetToastMessage1("A prisoner?! He must have escaped from the mines."))); StartCoroutine(M_Math.ExecuteDelayed(4f, Complete)); }
void Show() { gameObject.SetUIAlpha(0); StartCoroutine(M_Math.ExecuteDelayed(m_Item.GetIndex() == 0 ? 0.5f : 4f, () => StartCoroutine(M_Extensions.YieldT((f) => { gameObject.SetUIAlpha(f); }, 0.5f)) )); }
void OnStatUpdated(Stat s) { if (s.StatType == StatType.adrenaline && m_action.GetRequirements().Select(si => si.StatType).ToList().Contains(s.StatType)) { M_Math.ExecuteDelayed(StatUpdateDelay, SetBaseState); } }
public override void Remove() { m_Item.OnCancel -= Remove; m_Item.OnComplete -= Updated; StartCoroutine(M_Math.ExecuteDelayed(1.5f, Removed)); }
void CheckSpeech(Unit u, string[] texts, string arg) { if (u == m_Unit) { StopAllCoroutines(); TF.text = string.Format(texts[0], arg); TextPlate.SetActive(true); StartCoroutine(M_Math.ExecuteDelayed(texts.Length * 0.5f + 2.5f, () => TextPlate.SetActive(false))); } }
void TriggerDelayed(Speech speech, float delay) { if (speech != null) { StartCoroutine(M_Math.ExecuteDelayed(delay, () => TriggerSpeech(m_Unit, speech.Lines))); } else { MDebug.LogWarning("speech not found"); } }
public void OnLoot(Unit _u) { int lootable_amount = GetLootableAmount(_u); if (lootable_amount > 0) { item_lootable.SetCount(item_lootable.GetCount() - lootable_amount); GetInventory(_u).ModifyItem(item_lootable.GetItemType(), lootable_amount); } crate.GetComponent <Animator>().SetTrigger("bOpened"); if (item_lootable.GetCount() == 0) { StartCoroutine(M_Math.ExecuteDelayed(2f, RemoveLoot)); // MDebug.Log("^loot removing loot soon"); } }
public static void ExecuteDelayed(this MonoBehaviour comp, float time, System.Action func) { comp.StartCoroutine(M_Math.ExecuteDelayed(time, func)); }
void Removed() { StartCoroutine(M_Extensions.YieldT((f) => { gameObject.SetUIAlpha(1 - f); }, 0.5f)); StartCoroutine(M_Math.ExecuteDelayed(0.5f, () => { OnRemoved.AttemptCall(); Destroy(this.gameObject); })); }