public override void OnCreated(ILoading loading) { base.OnCreated(loading); if (_isReleased) { if (GetPath() != PATH_NOT_FOUND) { _container = new GameObject(REX_OBJECT_NAME); _newRoads = _container.AddComponent<NetCollection>(); _newRoads.name = NEWROADS_NETCOLLECTION; _initializer = _container.AddComponent<Initializer>(); _initializer.InstallationCompleted += InitializationCompleted; } _isReleased = false; } }
private void InitializationCompleted() { Loading.QueueAction(() => { if (_initializer != null) { Object.Destroy(_initializer); _initializer = null; } if (_container != null) { _localizationInstaller = _container.AddComponent<LocalizationInstaller>(); _localizationInstaller.InstallationCompleted += LocInstallationCompleted; _assetsInstaller = _container.AddComponent<AssetsInstaller>(); _assetsInstaller.InstallationCompleted += AssetsInstallationCompleted; _roadsInstaller = _container.AddComponent<RoadsInstaller>(); _roadsInstaller.NewRoads = _newRoads; _roadsInstaller.InstallationCompleted += RoadsInstallationCompleted; } }); }
public override void OnReleased() { base.OnReleased(); if (_isReleased) { return; } if (_initializer != null) { Object.Destroy(_initializer); _initializer = null; } if (_localizationInstaller != null) { Object.Destroy(_localizationInstaller); _localizationInstaller = null; } if (_assetsInstaller != null) { Object.Destroy(_assetsInstaller); _assetsInstaller = null; } if (_roadsInstaller != null) { Object.Destroy(_roadsInstaller); _roadsInstaller = null; } if (_menusInstaller != null) { Object.Destroy(_menusInstaller); _menusInstaller = null; } if (_newRoads != null) { Object.Destroy(_newRoads); _newRoads = null; } if (_container != null) { Object.Destroy(_container); _container = null; } _isReleased = true; }