Exemple #1
0
    // coroutine section
    // game start loading Process
    IEnumerator GameStartLoadingProcess()
    {
        // load game data
        DataManager.LoadPlayerData();

        player = DataManager.GetPlayerData();

        if (DataManager.PlayFirst)
        {
            presentGameMode = GameMode.Create;
            SetUI();
            yield break;
        }
        else
        {
            presentGameMode = GameMode.Loading;
            SetUI();
        }

        yield return(new WaitForSeconds(2f));

        // set field data
        fieldManager.CheckStepFieldData();

        // start store create
        StartCoroutine(storeManager.CreateStoreObject());

        while (true)
        {
            // loading game data false -> wait
            if (!storeManager.CreateComplete)
            {
                // set main ui state -> loading state
                yield return(1.0f);
            }
            // loading game data success -> start game
            else
            {
                try
                {
                    // set camera mode
                    cameraControl.SetCameraDefault(GameMode.Store);
                }
                catch (NullReferenceException e)
                {
                    Debug.Log(e.StackTrace);
                    Debug.Log(e.Message);
                }
                catch (UnassignedReferenceException e)
                {
                    Debug.Log(e.StackTrace);
                    Debug.Log(e.Message);
                }

                // set main ui state -> store state
                presentGameMode = GameMode.Store;
                mainUI.UIModeChange();
                mainUI.LoadingSceneState(false);
                StartCoroutine(fieldManager.CreateFieldItemPolicy());
                yield break;
            }
        }
    }