-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class RandomSoundPlayer : MonoBehaviour | ||
{ | ||
public AudioClip[] sounds; | ||
|
||
public float minTime = 1f; | ||
public float maxTime = 10f; | ||
|
||
float timer = 3f; | ||
AudioSource audio; | ||
|
||
|
||
void Start() | ||
{ | ||
audio = gameObject.GetComponent<AudioSource>(); | ||
} | ||
|
||
void Update () | ||
{ | ||
if(timer > 0) | ||
{ | ||
timer -= Time.deltaTime; | ||
} | ||
else | ||
{ | ||
audio.clip = sounds[Random.Range(0, sounds.Length)]; | ||
audio.Play(); | ||
timer = Random.Range(minTime, maxTime); | ||
|
||
//Debug.Log("win"); | ||
} | ||
|
||
} | ||
} |
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.
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.
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.
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.
This file was deleted.