Beispiel #1
0
 private static Coroutines GetInstance()
 {
     if (!isInitialized)
     {
         m_instance = CreateSingleton();
     }
     return(m_instance);
 }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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)));
        }
Beispiel #4
0
        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;
        }
Beispiel #5
0
        public void Stop()
        {
            if (this.isActive)
            {
                if (owner == null)
                {
                    Coroutines.StopRoutine(this.routine);
                }
                else
                {
                    this.owner.StopCoroutine(this.routine);
                }

                this.NotifyAboutCoroutineCanceled();
                this.routine = null;
            }
        }