private void LoadAndStartGame(Map map, uint difficultyIndex) { this.map = map; currentDiff = map.GetDifficulty(difficultyIndex); musicLoader = map.GetSong(); musicLoaderEnumerator = musicLoader.GetAudioClip(); doAction = DoActionLoadMusic; OnStart?.Invoke(); }
private void DoActionLoadMusic() { if (musicLoaderEnumerator.MoveNext()) { return; } musicPlayer.SetMusic(map.timing, musicLoader.clip); musicLoaderEnumerator = null; musicLoader = null; //Permet d'attendre 1 frame avant le lancement de la musique doAction = DoActionStartGame; }
public static Map GetMap(string directoryPath) { Map lMap = new Map(); try { string lJsonString = HandleTextFile.ReadString(directoryPath + "/" + MAIN_JSON); lMap = JsonUtility.FromJson <Map>(lJsonString); lMap.directoryPath = directoryPath; lMap.audioType = AudioClipGetter.GetAudioType(lMap.audio); } catch (Exception error) { lMap.LoadError = error; } return(lMap); }