Exemple #1
0
        void Awake()
        {
            CDebug.DisplayMethod = CDebug.ConsoleLogMethod.Selected;
            //CDebug.LogThis(typeof(Injector));

            if (Instance != this && Instance != null)
            {
                Destroy(gameObject);
            }
            else
            {
                Instance  = this;
                _commands = new CommandQueue();

                // create framework manager objects
                _frameworkObjects = new SceneObjectData();
                _frameworkObjects.PushObjectAsSingleton(new SceneManager());

                Injector.BindTemplate("Framework_UseDiskAccess", _readWriteSettingsConfiguration);
                Injector.BindSingleton <EngineOptions>(Factory.Factory.Create <EngineOptions>(_frameworkObjects));

                // give App a getter.  Get options via:
                // Framework.App.Options.<Option>
                // Remember to apply options when necessary
                // true/false parameter tells App if it can use JSON to write and read default configurations from a HD.
                App = _frameworkObjects.PushObjectAsSingleton(Factory.Factory.Create <App>());

                _frameworkObjects.InitializeSceneObjects();

                Globals = new SceneObjectData();
                Globals.InitializeSceneObjects();

                // ProcessCommands() executes all commands in a co-routine
                StartCoroutine(ProcessCommands());

                DontDestroyOnLoad(gameObject);
            }

            // when Awake() is invoked we've loaded a new scene so we create the new view
            SceneManager.CreateSceneView();
        }
        void Awake()
        {
            CDebug.DisplayMethod = CDebug.ConsoleLogMethod.Selected;

            if (Instance != this && Instance != null)
            {
                Destroy(gameObject);
            }
            else
            {
                Instance = this;
                _commands = new CommandQueue();

                // create framework manager objects
                _frameworkObjects = new SceneObjectData();
                _frameworkObjects.PushObjectAsSingleton(new SceneManager());
                // give App a getter.  Get options via:
                // Framework.App.Options.<Option>
                // Remember to apply options when necessary
                App = _frameworkObjects.PushObjectAsSingleton(new App()) as App;

                Globals = new SceneObjectData();

                // ProcessCommands() executes all commands in a co-routine
                StartCoroutine(ProcessCommands());

                DontDestroyOnLoad(gameObject);
            }

            // when Awake() is invoked we've loaded a new scene so we create the new view
            SceneManager.CreateSceneView();
        }
        void Awake()
        {
            CDebug.DisplayMethod = CDebug.ConsoleLogMethod.Selected;

            if (Instance != this && Instance != null)
            {
                Destroy(gameObject);
            }
            else
            {
                Instance = this;
                _commands = new CommandQueue();

                // create framework manager objects
                _frameworkObjects = new SceneObjectData();
                _frameworkObjects.PushObjectAsSingleton(new SceneManager());
                _frameworkObjects.PushObjectAsSingleton(new App());

                Globals = new SceneObjectData();

                StartCoroutine(ProcessCommands());

                DontDestroyOnLoad(gameObject);
            }

            SceneManager.CreateSceneView();
        }