public void Init(IBootConfig bootConfig = null) { if (bootConfig == null) { bootConfig = new DefaultBootConfig(); } _gameObject = new GameObject("GameContext"); resourceStore = new ResourceStore(); sceneDirector = _gameObject.AddComponent <SceneDirectorMock>(); sceneDirector.Init(_gameObject, bootConfig, resourceStore); timeKeeper = new TimeKeeper(sceneDirector); bgmPlayer = new BgmPlayer(); bgmPlayer.Init(_gameObject, bootConfig.numBgmSourcePool, sceneDirector, resourceStore); sePlayer = new SePlayer(); sePlayer.Init(_gameObject, bootConfig.numSeSourcePool, sceneDirector, resourceStore); signalHub = new SignalHub(sceneDirector); tweenerHub = new TweenerHub(sceneDirector, timeKeeper); objectPoolHub = new ObjectPoolHub(sceneDirector); bootConfig.OnGameBoot(); }
public void Init(IBootConfig bootConfig = null) { if (bootConfig == null) { bootConfig = new DefaultBootConfig(); } _contextGameObj = new GameObject("AltoGlobalContext"); _audioSourceGameObj = new GameObject("AltoAudioSource"); GameObject.DontDestroyOnLoad(_contextGameObj); GameObject.DontDestroyOnLoad(_audioSourceGameObj); resourceStore = new ResourceStore(); sceneDirector = _contextGameObj.AddComponent <SceneDirector>(); sceneDirector.Init(_contextGameObj, bootConfig, resourceStore); sceneDirector.sceneUpdate += OnSceneUpdate; timeKeeper = new TimeKeeper(sceneDirector); bgmPlayer = new BgmPlayer(); bgmPlayer.Init(_audioSourceGameObj, bootConfig.numBgmSourcePool, sceneDirector, resourceStore); sePlayer = new SePlayer(); sePlayer.Init(_audioSourceGameObj, bootConfig.numSeSourcePool, sceneDirector, resourceStore); if (bootConfig.useGlobalAudioListener) { _contextGameObj.AddComponent <AudioListener>(); } signalHub = new SignalHub(sceneDirector); tweenerHub = new TweenerHub(sceneDirector, timeKeeper); objectPoolHub = new ObjectPoolHub(sceneDirector); bootConfig.OnGameBoot(); }