public bool RequestUpdate(IUpdatableOnDemand updateRequester) { var contains = _updating.Contains(updateRequester); if (_behaviour.gameObject.activeSelf) { _behaviour.StartCoroutine(UpdateCoroutine(updateRequester)); } return(!contains); }
public bool RequestUpdate(IUpdatableOnDemand updateRequester) { var contains = _updating.Contains(updateRequester); if (!contains) { StartCoroutine(UpdateCoroutine(updateRequester)); } return(!contains); }
public bool RequestUpdate(IUpdatableOnDemand updateRequester) { var contains = _updatingHash.Contains(updateRequester); if (!contains) { _updating.Add(updateRequester); _updatingHash.Add(updateRequester); } return(!contains); }
IEnumerator UpdateCoroutine(IUpdatableOnDemand updateRequester) { if (!_updating.Contains(updateRequester)) { _updating.Add(updateRequester); while (_behaviour != null && updateRequester.Update(Time.deltaTime)) { yield return(null); } _updating.Remove(updateRequester); } }