public static GameObject CreateSoundPlayer(SoundNode soundNode) { // Create the object that will be responsible for playing the sound GameObject go = new GameObject("Sound Handler"); SoundPlayer soundPlayer = go.AddComponent <SoundPlayer>(); soundPlayer.soundNode = soundNode; return(go); }
public override void HandleFluentNode(FluentNode fluentNode) { soundNode = (SoundNode)fluentNode; // Create the sound player GameObject soundPlayerGameObject = SoundPlayer.CreateSoundPlayer(soundNode); SoundPlayer soundPlayer = soundPlayerGameObject.GetComponent <SoundPlayer>(); soundPlayer.DonePlaying += soundPlayer_DonePlaying; // Make the game object the parent soundPlayer.transform.parent = soundNode.GameObject.transform; SoundPlayers.Add(soundPlayerGameObject); }