Skip to content

Commit 08992fc

Browse files
committed
Fixed audio bugs and max name length
1 parent 853300c commit 08992fc

6 files changed

Lines changed: 28 additions & 10 deletions

File tree

Assets/EC2018/BuildingController.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ public void Setup (Building building) {
9898

9999
audioSource.clip = teslaConstruction;
100100
audioSource.pitch = Random.Range(0.7f, 1.3f);
101-
audioSource.Play();
101+
if (!audioSource.isPlaying) {
102+
audioSource.Stop();
103+
audioSource.Play();
104+
}
102105
}
103106
} else if (building.BuildingType == BuildingType.Defense) {
104107
if(timeLeft == 2) {
@@ -108,7 +111,10 @@ public void Setup (Building building) {
108111

109112
audioSource.clip = defenseConstruction;
110113
audioSource.pitch = Random.Range(0.7f, 1.3f);
111-
audioSource.Play();
114+
if (!audioSource.isPlaying) {
115+
audioSource.Stop();
116+
audioSource.Play();
117+
}
112118
}
113119
} else {
114120
if(timeLeft == 0) {
@@ -123,7 +129,10 @@ public void Setup (Building building) {
123129
audioSource.volume = 0.3f;
124130
}
125131
audioSource.pitch = Random.Range(0.7f, 1.3f);
126-
audioSource.Play();
132+
if (!audioSource.isPlaying) {
133+
audioSource.Stop();
134+
audioSource.Play();
135+
}
127136
}
128137
}
129138

Assets/EC2018/Instantiator.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,15 @@ public void InstantiateTeslaHit(List<HitList> hitList, Player playerA, Player pl
171171
var originPlayer = originTower.PlayerType;
172172

173173
if(originPlayer == PlayerType.A) {
174-
teslaFiringSourceA.Play();
174+
if(!teslaFiringSourceA.isPlaying) {
175+
teslaFiringSourceA.Stop();
176+
teslaFiringSourceA.Play();
177+
}
175178
} else {
176-
teslaFiringSourceB.Play();
179+
if(!teslaFiringSourceB.isPlaying) {
180+
teslaFiringSourceB.Stop();
181+
teslaFiringSourceB.Play();
182+
}
177183
}
178184

179185
// IRON CURTAIN HIT

Assets/EC2018/MissileController.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ void Update() {
3939
public void PlaySound(AudioClip clip) {
4040
audioSource.clip = clip;
4141
audioSource.pitch = Random.Range(0.7f, 1f);
42-
audioSource.Play();
42+
if (!audioSource.isPlaying) {
43+
audioSource.Stop();
44+
audioSource.Play();
45+
}
4346
}
4447

4548
public void HaltAndSetToNextStatePosition() {

Assets/EC2018/UIManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using UnityEngine;
1+
using UnityEngine;
22
using UnityEngine.UI;
33
using EC2018.Entities;
44
using EC2018.Enums;

Assets/Scenes/CountInScene.unity

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ MonoBehaviour:
11161116
m_EditorClassIdentifier:
11171117
tmpPlayerA: {fileID: 300225247}
11181118
tmpPlayerB: {fileID: 1831951726}
1119-
MaxLength: 20
1119+
MaxLength: 31
11201120
--- !u!1 &1116120781
11211121
GameObject:
11221122
m_ObjectHideFlags: 0

Assets/Scenes/ReplayScene.unity

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12248,7 +12248,7 @@ MonoBehaviour:
1224812248
losingPlayerStatsText: {fileID: 148899221}
1224912249
barrierHealthA: {fileID: 912874940}
1225012250
barrierHealthB: {fileID: 1641376618}
12251-
MaxLength: 20
12251+
MaxLength: 31
1225212252
--- !u!114 &893612604
1225312253
MonoBehaviour:
1225412254
m_ObjectHideFlags: 0
@@ -28928,7 +28928,7 @@ AudioSource:
2892828928
serializedVersion: 4
2892928929
OutputAudioMixerGroup: {fileID: 0}
2893028930
m_audioClip: {fileID: 0}
28931-
m_PlayOnAwake: 1
28931+
m_PlayOnAwake: 0
2893228932
m_Volume: 0.1
2893328933
m_Pitch: 1
2893428934
Loop: 1

0 commit comments

Comments
 (0)