//Create a GameObject with a LoopedBGM on it. private ALoopedBGM AddNewLoopedBGM() { GameObject g = new GameObject(); g.transform.SetParent(this.transform); ALoopedBGM loopedBGM = g.AddComponent <LoopedBGM>(); return(loopedBGM); }
//Create a child GameObject with a LoopedBGM on it, for every //song in the list. private List <ALoopedBGM> InitSourceList() { List <ALoopedBGM> result = new List <ALoopedBGM>(); foreach (AudioClip song in this.songs) { ALoopedBGM loopedBGM = this.AddNewLoopedBGM(); loopedBGM.SetSong(song, this.loopSeconds); result.Add(loopedBGM); } return(result); }