public void Handle(LevelUnloaded message) { if (_level.Name == message.Level.Name) { _level = null; } }
public void LoadLevel(LevelType levelType) { if (_currentLevel != null) { GameObject.Destroy(_currentLevel); LevelUnloaded?.Invoke(); } _currentLevel = GameObject.Instantiate(Data.Instance.LevelData.GetPrefab(levelType)); Services.Instance.LevelService.CurrentLevel = levelType; Time.timeScale = 1; LevelLoaded?.Invoke(); }