Exemple #1
0
    void OnDestroy()
    {
        // Persistent Data 저장 (forced)
        FSNPersistentData.Save(true);

        // 디버그 모듈 해제
        FSNDebug.Uninstall();
    }
Exemple #2
0
    //===========================================================================

    void Awake()
    {
        if (m_awake)
        {
            return;
        }
        m_awake = true;

        if (s_instance)
        {
            Debug.LogError("[FSNEngine] Duplicated engine object!");
            return;
        }
        s_instance = this;


        // 세팅 초기화

        m_inGameSetting = new FSNInGameSetting(true);

        // Persistent Data 불러오기
        FSNPersistentData.Load();


        // 모듈 초기화

        m_moduleRefDict = new Dictionary <string, FSNModule>();

        var modulesFound = GetComponentsInChildren <FSNModule>();                                               // 오브젝트 구조 안에서 모듈 컴포넌트 찾기

        foreach (FSNModule module in modulesFound)
        {
            m_moduleRefDict[module.ModuleName] = module;
        }

        // 필요 모듈 중에 빠진 게 있는지 체크
        var essentialModules = System.Enum.GetNames(typeof(ModuleType));

        foreach (string moduleName in essentialModules)
        {
            if (!m_moduleRefDict.ContainsKey(moduleName))
            {
                Debug.LogError("[FSNEngine] Essential module not found : " + moduleName);
            }
        }

        InitAllModules();                                                                                                                               // 찾아낸 모듈 모두 초기화


        // 보조 컴포넌트 초기화

        m_unityCallSvr = gameObject.AddComponent <FSNDefaultUnityCallServer>();
        gameObject.AddComponent <FSNFundamentalScriptFunctions>();

        m_seqEngine = gameObject.AddComponent <FSNSequenceEngine>();
        m_seqEngine.Initialize();

        m_ctrlSystem = gameObject.AddComponent <FSNControlSystem>();
        m_ctrlSystem.Initialize();

        // 초기화 완료 콜백
        CallAfterInitEvents();

        // 디버그 모듈 초기화
        FSNDebug.Install();
    }