-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShaderTest.cs
44 lines (36 loc) · 993 Bytes
/
ShaderTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using UnityEngine;
using System.Collections;
public class ShaderTest : MonoBehaviour {
public AudioClip clip;
public AudioSource source;
public SongGenre.Genre genre;
public FogControl fg;
public ShaderManager sm;
public TreeGenerator tg;
public TreeLeaves tl;
public GameObject leaf;
public CylBuildingMaker cbm;
private SpectrumAnalyzer sa;
// Use this for initialization
void Start () {
tl.tg = tg;
tl.leaves = leaf;
tg.pEvent += tl.MakeLikeATree;
tg.Init ();
StartCoroutine (tg.Grow ());
cbm.BuildMe ();
float [] data = new float [clip.samples * clip.channels];
clip.GetData (data, 0);
sa = new SpectrumAnalyzer (data, clip.length);
sa.Run ();
StartCoroutine ("GetThisParty");
}
IEnumerator GetThisParty () {
while (!sa.done) yield return new WaitForSeconds (.1f);
source.clip = clip;
source.Play ();
sm.Begin (genre, sa, null, fg);
foreach (MeshRenderer mr in MainManager.meshManager) mr.enabled = true;
yield return null;
}
}