// load level data private void LoadLevel(LevelData leveldata) { this._leveldata = leveldata; // load background image Sprite bgImg = Resources.Load <Sprite>(Constants.BackgroundImagePath + Path.DirectorySeparatorChar + leveldata.BackgroundImage); Debug.Log(Constants.BackgroundImagePath + Path.DirectorySeparatorChar + leveldata.BackgroundImage); if (null != _backgroundImage && null != bgImg) { _backgroundImage.sprite = bgImg; } else { Debug.LogError("Unable to load background image"); } // load music controller AudioClip bgMusicAudio = Resources.Load <AudioClip>(Constants.AudioPath + Path.DirectorySeparatorChar + leveldata.Music); Debug.Log(Constants.AudioPath + Path.DirectorySeparatorChar + leveldata.Music); if (null != _backgroundAudioSource && null != bgMusicAudio) { _backgroundAudioSource.clip = bgMusicAudio; _backgroundAudioSource.Play(); } else { Debug.LogError("Unable to load background music"); } ReScale(); _battleManager = new BattleManager(); _battleManager.Initialize(CreateContext(leveldata)); _battleManager.AddBattleEventListener(this); }