public override void DeInitialize() { _eventAggregator.Remove <ImageLoadingCompletedEvent>(CreateLevel); _cardsComponent.DeInitialize(); _timeTicker.OnTick -= _cardsComponent.OnUpdate; _cardsComponent = null; _currentLevelView.ReleaseItemView(); _currentLevelView = null; base.DeInitialize(); }
private void CreateLevel(ImageLoadingCompletedEvent sender) { _currentLevelView = ViewGenerator.GetOrCreateItemView <LevelView>(string.Format(GameConstants.LevelFormat, "Demo")); _currentLevelView.SetPosition(Vector3.zero); if (_cam == null) { _cam = ProjectContext.Instance.Container.Resolve <PlayerCamera>(); _cam.SetTarget(_currentLevelView.Background); } _cardsComponent = new CardsComponent(); _cardsComponent.Initialize(); _timeTicker.OnTick += _cardsComponent.OnUpdate; }