public void TurnOff(SwitchEventArgs e) { if (m_switchCoroutine == null) { m_switchCoroutine = StartCoroutine(TurnOffEnumerator(e)); } }
private IEnumerator TurnOffEnumerator(SwitchEventArgs e) { var delay = e.m_delay; if (delay != 0f) { yield return(new WaitForSeconds(delay)); } if (m_isOn == 1) { m_isOn = 0; if (m_turnedOff != null) { m_turnedOff.Invoke(); } if (m_turnedOffEventHandle != null) { m_turnedOffEventHandle(this, e); } } m_switchCoroutine = null; }
public void TurnOff() { var args = new SwitchEventArgs(); TurnOff(args); }