private static Coroutines GetInstance() { if (!isInitialized) { m_instance = CreateSingleton(); } return(m_instance); }
public Coroutine ToJsonAsync(UnityAction <string> callback) { if (this.isConverting) { throw new Exception("Game State is converting now."); } this.convertingRoutine = Coroutines.StartRoutine(this.ToJsonAsyncRoutine(callback)); return(this.convertingRoutine); }
public Coroutine Start(T arg) { this.Stop(); if (owner == null) { return(this.routine = Coroutines.StartRoutine(WorkRoutine(arg))); } return(this.routine = this.owner.StartCoroutine(WorkRoutine(arg))); }
private IEnumerator ToJsonAsyncRoutine(UnityAction <string> callback) { this.isConverting = true; yield return(Coroutines.StartRoutine(this.SyncJsonsWithEntitiesAsyncRoutine())); var jsonGameState = JsonUtility.ToJson(this); callback?.Invoke(jsonGameState); this.isConverting = false; }
public void Stop() { if (this.isActive) { if (owner == null) { Coroutines.StopRoutine(this.routine); } else { this.owner.StopCoroutine(this.routine); } this.NotifyAboutCoroutineCanceled(); this.routine = null; } }