Esempio n. 1
0
    private void Awake()
    {
        //testzone
        //gameStartSettings.generationMode = ChunkGenerationMode.GameLoading;
        //savename = "test";
        //

        if (realMaster != null & realMaster != this)
        {
            Destroy(this);
            return;
        }
        gameMode      = _gameMode;
        realMaster    = this;
        sceneClearing = false;
        if (PoolMaster.current == null)
        {
            PoolMaster pm = gameObject.AddComponent <PoolMaster>();
            pm.Load();
        }
        if (gameMode == GameMode.Play)
        {
            if (globalMap == null)
            {
                globalMap = gameObject.AddComponent <GlobalMap>();
            }
            globalMap.Prepare();
            eventTracker = new EventChecker();
        }
        if (environmentMaster == null)
        {
            environmentMaster = new GameObject("Environment master").AddComponent <EnvironmentMaster>();
        }
        environmentMaster.Prepare();
        if (audiomaster == null)
        {
            audiomaster = gameObject.AddComponent <Audiomaster>();
            audiomaster.Prepare();
        }
        if (geologyModule == null)
        {
            geologyModule = gameObject.AddComponent <GeologyModule>();
        }
    }
    //

    private void Awake()
    {
        gameRules = GameRules.defaultRules;
        if (testMode && test_gameStartSettings != null)
        {
            _applyingGameStartSettings = test_gameStartSettings;
            test_gameStartSettings     = null;
        }
        if (_applyingGameStartSettings == null && startSettings == null)
        {
            _applyingGameStartSettings = GameStartSettings.GetDefaultStartSettings();
        }
        if (startSettings == null)
        {
            startSettings = _applyingGameStartSettings;
            _applyingGameStartSettings = null;
        }
        gameMode = startSettings.DefineGameMode();
        if (gameMode == GameMode.MainMenu)
        {
            Destroy(gameObject);
            return;
        }
        if (realMaster != null & realMaster != this)
        {
            Destroy(realMaster);
            realMaster = this;
            return;
        }
        realMaster    = this;
        sceneClearing = false;
        //
        uicontroller = UIController.GetCurrent();
        //
        if (PoolMaster.current == null)
        {
            PoolMaster pm = gameObject.AddComponent(typeof(PoolMaster)) as PoolMaster;
            pm.Load();
        }
        if (gameMode == GameMode.Survival)
        {
            globalMap = InitializeGlobalMap();
        }
        if (environmentMaster == null)
        {
            environmentMaster = new GameObject("Environment master").AddComponent <EnvironmentMaster>();
        }
        environmentMaster.Prepare();

        if (audiomaster == null)
        {
            audiomaster = gameObject.AddComponent <Audiomaster>();
            audiomaster.Prepare();
        }
        if (geologyModule == null)
        {
            geologyModule = gameObject.AddComponent <GeologyModule>();
        }

        Screen.sleepTimeout = SleepTimeout.NeverSleep;
    }