Exemple #1
0
    IEnumerator onReStart(Action cb)
    {
        yield return(new WaitForEndOfFrame());

        if (null != cb)
        {
            cb();
        }
        yield return(new WaitForEndOfFrame());

        Cleanup();
        yield return(new WaitForEndOfFrame());

        if (null != lua)
        {
            lua.Close(); lua = null;
        }
        yield return(new WaitForEndOfFrame());

        DG.Tweening.DOTween.KillAll(true);
        DG.Tweening.DOTween.ClearCachedTweens();
        DG.Tweening.DOTween.Clear(true);
        yield return(new WaitForEndOfFrame());

        GameObject[] allObj = Transform.FindObjectsOfType <GameObject>();
        for (int i = 0; i < allObj.Length; ++i)
        {
            if (allObj[i] != gameObject)
            {
                GameObject.Destroy(allObj[i]);
            }
        }
        yield return(new WaitForEndOfFrame());

        RunApp();
    }