-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class MusicPlayer : MonoBehaviour | ||
{ | ||
[SerializeField] private string[] clips; | ||
private int clipIndex; | ||
|
||
void Start() | ||
{ | ||
StartCoroutine(IPlaySound()); | ||
} | ||
|
||
IEnumerator IPlaySound() | ||
{ | ||
yield return new WaitForSeconds(Random.Range(40f, 60f)); | ||
|
||
clipIndex = Random.Range(0, clips.Length); | ||
AudioManager.instance.Play(clips[clipIndex]); | ||
|
||
yield return new WaitForSeconds(AudioManager.instance.GetSound(clips[clipIndex]).clip.length); | ||
StartCoroutine(IPlaySound()); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.