Skip to content

Commit 61c0ce5

Browse files
committed
Added sounds
1 parent 19de5c1 commit 61c0ce5

28 files changed

Lines changed: 392 additions & 348 deletions

Assets/Draw.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ public class Draw : MonoBehaviour
1010
private Touch touch;
1111
public int order;
1212
public int finished = 0;
13+
public float wait;
14+
private bool doneWaiting = false;
15+
public AudioClip[] clips;
16+
private bool playedAudio = false;
17+
public float wait2;
1318
//if there is a better way pls tell me. I can only think about reading this from a file.
1419
public Vector3[,] positions = { { new Vector3(2.17f, 1.3f, 0f), new Vector3(0.62f, 1.3f, 0f) } , //back
1520
{ new Vector3(-0.92f, 2.13f, 0f), new Vector3(0.51f, 1.37f, 0f) } , //front
@@ -31,10 +36,32 @@ void Start() {
3136
void Update()
3237
{
3338
if (order >= 9) {
39+
if (wait <= 0 && !doneWaiting)
40+
{
41+
GameObject.Find("Main Camera").GetComponent<Camera>().backgroundColor = Color.black;
42+
doneWaiting = true;
43+
GetComponent<AudioSource>().clip = clips[0];
44+
GetComponent<AudioSource>().Play();
45+
}
46+
else if (!doneWaiting)
47+
{
48+
wait -= Time.deltaTime;
49+
}
3450
//Align lines into place
35-
if (finished == 9) {
51+
else if (finished == 9)
52+
{
3653
StartVideo();
3754
}
55+
else if (!playedAudio && wait2 >= 0) {
56+
wait2 -= Time.deltaTime;
57+
}
58+
else if (!playedAudio)
59+
{
60+
GetComponent<AudioSource>().clip = clips[1];
61+
GetComponent<AudioSource>().Play();
62+
order++;
63+
playedAudio = true;
64+
}
3865
}
3966
else if (Input.touchCount > 0) {
4067
touch = Input.GetTouch(0);

Assets/Line.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public class Line : MonoBehaviour
2020
private bool reported = false;
2121
private float[] step;
2222

23+
public AudioClip[] clips;
24+
2325
void Start()
2426
{
2527
StartPos = transform.position;
@@ -36,7 +38,7 @@ void Start()
3638

3739
void Update()
3840
{
39-
if (script.GetComponent<Draw>().order >= 9)
41+
if (script.GetComponent<Draw>().order >= 10)
4042
{
4143
//Align into position
4244
for (int i = 0; i < 2; i++)
@@ -75,6 +77,8 @@ void Update()
7577

7678
float distance = Math.Abs(Vector3.Distance(current, StartPos));
7779
if (distance >= length) {
80+
GetComponent<AudioSource>().clip = clips[order];
81+
GetComponent<AudioSource>().Play();
7882
for (int i = 0; i < 2; i++)
7983
{
8084
step[i] = Math.Abs(Vector3.Distance(final[order, i], pos[i])) * stepSpeed;

Assets/Line.prefab

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ GameObject:
1111
- component: {fileID: 1945975318650849095}
1212
- component: {fileID: 1609963738480068943}
1313
- component: {fileID: -558291657561903659}
14+
- component: {fileID: 6938631207205492042}
1415
m_Layer: 0
1516
m_Name: Line
1617
m_TagString: Untagged
@@ -143,4 +144,110 @@ MonoBehaviour:
143144
m_Name:
144145
m_EditorClassIdentifier:
145146
height: 0.1
146-
stepSpeed: 1
147+
stepSpeed: 0.7
148+
clips:
149+
- {fileID: 8300000, guid: c82796cc27ba2d14daeb00027f8360e1, type: 3}
150+
- {fileID: 8300000, guid: 2ab69026dec3605409daf24570a459fa, type: 3}
151+
- {fileID: 8300000, guid: 84eece656912271488c9577165e4ace8, type: 3}
152+
- {fileID: 8300000, guid: db1e20bf66483ca44955c02a54955bef, type: 3}
153+
- {fileID: 8300000, guid: 647cf279b7f6a84489b8004c0289dd0b, type: 3}
154+
- {fileID: 8300000, guid: e970c1c66c02fed4eb25f9652fa5b331, type: 3}
155+
- {fileID: 8300000, guid: 7f72ec6443619ca44be348141f45dd54, type: 3}
156+
- {fileID: 8300000, guid: d2acf1ca7f458ab4996c8ad448dd73e0, type: 3}
157+
- {fileID: 8300000, guid: b203df85c0bf1434a89d1777026f85f2, type: 3}
158+
--- !u!82 &6938631207205492042
159+
AudioSource:
160+
m_ObjectHideFlags: 0
161+
m_CorrespondingSourceObject: {fileID: 0}
162+
m_PrefabInstance: {fileID: 0}
163+
m_PrefabAsset: {fileID: 0}
164+
m_GameObject: {fileID: 1945975318650849093}
165+
m_Enabled: 1
166+
serializedVersion: 4
167+
OutputAudioMixerGroup: {fileID: 0}
168+
m_audioClip: {fileID: 0}
169+
m_PlayOnAwake: 1
170+
m_Volume: 1
171+
m_Pitch: 1
172+
Loop: 0
173+
Mute: 0
174+
Spatialize: 0
175+
SpatializePostEffects: 0
176+
Priority: 128
177+
DopplerLevel: 1
178+
MinDistance: 1
179+
MaxDistance: 500
180+
Pan2D: 0
181+
rolloffMode: 0
182+
BypassEffects: 0
183+
BypassListenerEffects: 0
184+
BypassReverbZones: 0
185+
rolloffCustomCurve:
186+
serializedVersion: 2
187+
m_Curve:
188+
- serializedVersion: 3
189+
time: 0
190+
value: 1
191+
inSlope: 0
192+
outSlope: 0
193+
tangentMode: 0
194+
weightedMode: 0
195+
inWeight: 0.33333334
196+
outWeight: 0.33333334
197+
- serializedVersion: 3
198+
time: 1
199+
value: 0
200+
inSlope: 0
201+
outSlope: 0
202+
tangentMode: 0
203+
weightedMode: 0
204+
inWeight: 0.33333334
205+
outWeight: 0.33333334
206+
m_PreInfinity: 2
207+
m_PostInfinity: 2
208+
m_RotationOrder: 4
209+
panLevelCustomCurve:
210+
serializedVersion: 2
211+
m_Curve:
212+
- serializedVersion: 3
213+
time: 0
214+
value: 0
215+
inSlope: 0
216+
outSlope: 0
217+
tangentMode: 0
218+
weightedMode: 0
219+
inWeight: 0.33333334
220+
outWeight: 0.33333334
221+
m_PreInfinity: 2
222+
m_PostInfinity: 2
223+
m_RotationOrder: 4
224+
spreadCustomCurve:
225+
serializedVersion: 2
226+
m_Curve:
227+
- serializedVersion: 3
228+
time: 0
229+
value: 0
230+
inSlope: 0
231+
outSlope: 0
232+
tangentMode: 0
233+
weightedMode: 0
234+
inWeight: 0.33333334
235+
outWeight: 0.33333334
236+
m_PreInfinity: 2
237+
m_PostInfinity: 2
238+
m_RotationOrder: 4
239+
reverbZoneMixCustomCurve:
240+
serializedVersion: 2
241+
m_Curve:
242+
- serializedVersion: 3
243+
time: 0
244+
value: 1
245+
inSlope: 0
246+
outSlope: 0
247+
tangentMode: 0
248+
weightedMode: 0
249+
inWeight: 0.33333334
250+
outWeight: 0.33333334
251+
m_PreInfinity: 2
252+
m_PostInfinity: 2
253+
m_RotationOrder: 4

0 commit comments

Comments
 (0)