Esempio n. 1
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);
        }
Esempio n. 2
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)));
        }
Esempio n. 3
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;
        }