Skip to content

Commit d8e0186

Browse files
committed
Added sound effects
- Multiple Hits - Intro Announcer - End Game effect
1 parent 879c9f5 commit d8e0186

114 files changed

Lines changed: 2699 additions & 47 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Assets/EC2018/BuildingController.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
using EC2018.Enums;
77

88
namespace EC2018 {
9-
9+
10+
[RequireComponent(typeof(AudioSource))]
1011
public class BuildingController : MonoBehaviour {
1112

1213
public int MaxHealth;
@@ -19,7 +20,12 @@ public class BuildingController : MonoBehaviour {
1920
public GameObject constructionAnimation;
2021

2122
public bool isUnderConstruction;
22-
23+
24+
public AudioClip otherConstruction;
25+
public AudioClip defenseConstruction;
26+
public AudioClip teslaConstruction;
27+
AudioSource audioSource;
28+
2329
float lerpTime;
2430

2531
float startScale;
@@ -33,6 +39,7 @@ public Building building {
3339
}
3440

3541
void Awake() {
42+
audioSource = GetComponent<AudioSource> ();
3643

3744
gameSpeed = CommandLineUtil.GetRoundStep ();
3845

@@ -87,18 +94,27 @@ public void Setup (Building building) {
8794
GameObject obj = Instantiate (constructionAnimation);
8895
obj.transform.position = transform.position + obj.transform.position;
8996
Destroy (obj, 10f * gameSpeed);
97+
98+
audioSource.clip = teslaConstruction;
99+
audioSource.Play();
90100
}
91101
} else if (building.BuildingType == BuildingType.Defense) {
92102
if(timeLeft == 2) {
93103
GameObject obj = Instantiate (constructionAnimation);
94104
obj.transform.position = transform.position + obj.transform.position;
95105
Destroy (obj, 3f * gameSpeed);
106+
107+
audioSource.clip = defenseConstruction;
108+
audioSource.Play();
96109
}
97110
} else {
98111
if(timeLeft == 0) {
99112
GameObject obj = Instantiate (constructionAnimation);
100113
obj.transform.position = transform.position + obj.transform.position;
101114
Destroy (obj, gameSpeed);
115+
116+
audioSource.clip = otherConstruction;
117+
audioSource.Play();
102118
}
103119
}
104120

Assets/EC2018/Constants.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public static class Tags {
1616
public const string Defense = "Defense";
1717
public const string Energy = "Energy";
1818
public const string GroundTile = "GroundTile";
19-
public const string Barrier = "Barrier";
19+
public const string Barrier = "Barrier";
20+
public const string IronCurtainA = "IronCurtainA";
21+
public const string IronCurtainB = "IronCurtainB";
2022
public const string MissileCollider = "MissileCollider";
2123
public const string PlayerA = "Player A";
2224
public const string PlayerB = "Player B";

Assets/EC2018/Countdown.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ public class Countdown : MonoBehaviour {
1212
public float counterTime = 1f;
1313
public string[] kickOffPhrases;
1414

15+
public AudioClip[] announcerCountdown; // Must be 3 clips
16+
17+
public AudioClip[] announcerPhrases;
18+
public AudioSource announcerAudioSource;
19+
1520
void Start () {
1621
StartCoroutine (StartReplayScene ());
1722
}
@@ -20,17 +25,26 @@ IEnumerator StartReplayScene() {
2025
yield return new WaitForSeconds (startDelay);
2126
countdownText.fontSize = 40;
2227
countdownText.text = "3";
28+
announcerAudioSource.clip = announcerCountdown[2];
29+
announcerAudioSource.Play();
2330
yield return new WaitForSeconds (counterTime);
2431
countdownText.fontSize = 60;
2532
countdownText.text = "2";
33+
announcerAudioSource.clip = announcerCountdown[1];
34+
announcerAudioSource.Play();
2635
yield return new WaitForSeconds (counterTime);
2736
countdownText.fontSize = 80;
2837
countdownText.text = "1";
38+
announcerAudioSource.clip = announcerCountdown[0];
39+
announcerAudioSource.Play();
2940
yield return new WaitForSeconds (counterTime);
3041
countdownText.fontSize = 100;
3142

3243
int i = Random.Range(0, kickOffPhrases.Length);
3344

45+
announcerAudioSource.clip = announcerPhrases[i];
46+
announcerAudioSource.Play();
47+
3448
countdownText.text = kickOffPhrases[i];
3549
yield return new WaitForSeconds (counterTime);
3650
SceneManager.LoadScene(destinationScene, LoadSceneMode.Single);

Assets/EC2018/GameManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace EC2018 {
1616
public class GameManager : MonoBehaviour {
1717
const string StartReplayMethod = "StartReplay";
1818

19-
public MusicFadeOut musicFadeOut;
19+
public GameObject backgroundMusic;
2020
public int startRound;
2121
public float roundStepTime = 0.7f;
2222

@@ -50,7 +50,7 @@ public void NavigateToReplayMenu() {
5050

5151
public void ReplayFinished() {
5252
gameFinished = true;
53-
musicFadeOut.StartFadeOut();
53+
backgroundMusic.SetActive(false);
5454
HaltAllGameObects();
5555
OnPauseInteraction ();
5656
gameStateManager.EndGame();

Assets/EC2018/Instantiator.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public class Instantiator : MonoBehaviour {
2222
public GameObject playerADestructionAnimation;
2323
public GameObject playerBDestructionAnimation;
2424

25-
public AudioSource audioSourceA;
26-
public AudioSource audioSourceB;
25+
public AudioSource teslaFiringSourceA;
26+
public AudioSource teslaFiringSourceB;
2727

2828
float timeStep;
2929

@@ -118,9 +118,9 @@ public void InstantiateTeslaHit(List<HitList> hitList, Player playerA, Player pl
118118
var originPlayer = originTower.PlayerType;
119119

120120
if(originPlayer == PlayerType.A) {
121-
audioSourceA.Play();
121+
teslaFiringSourceA.Play();
122122
} else {
123-
audioSourceB.Play();
123+
teslaFiringSourceB.Play();
124124
}
125125

126126
// IRON CURTAIN HIT

Assets/EC2018/MissileController.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ void OnTriggerEnter(Collider other) {
5656
case Constants.Tags.Barrier:
5757
Instantiate(explosion, transform.position, Quaternion.identity);
5858
gameObject.SetActive(false);
59+
break;
60+
case Constants.Tags.IronCurtainA:
61+
if(missile.PlayerType == EC2018.Enums.PlayerType.B) {
62+
Instantiate(explosion, transform.position, Quaternion.identity);
63+
gameObject.SetActive(false);
64+
}
65+
break;
66+
case Constants.Tags.IronCurtainB:
67+
if (missile.PlayerType == EC2018.Enums.PlayerType.A) {
68+
Instantiate(explosion, transform.position, Quaternion.identity);
69+
gameObject.SetActive(false);
70+
}
5971
break;
6072
}
6173
}

Assets/EC2018/TextMover.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ public class TextMover : MonoBehaviour {
88
public float startDelay = 0f;
99
public float moveTime = 1f;
1010

11+
public AudioSource onStopSound;
12+
1113
RectTransform rectTransform;
1214
Vector3 targetPos;
1315

1416
float lerpTime;
1517

18+
bool stopped;
19+
1620
void Start() {
1721
rectTransform = GetComponent<RectTransform>();
1822

@@ -28,6 +32,13 @@ void Update() {
2832
lerpTime += Time.deltaTime;
2933
rectTransform.position = Vector3.Lerp(rectTransform.position, targetPos, lerpTime);
3034
}
35+
36+
if(Vector3.Distance(rectTransform.position, targetPos) < 50) {
37+
if(!stopped) {
38+
onStopSound.Play();
39+
stopped = true;
40+
}
41+
}
3142
}
3243

3344
IEnumerator StartMoving() {

Assets/Prefabs/Attack Building A.prefab

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ GameObject:
7575
m_Component:
7676
- component: {fileID: 4810039397637134}
7777
- component: {fileID: 114171811415290612}
78+
- component: {fileID: 82772068547145606}
7879
m_Layer: 0
7980
m_Name: Attack Building A
8081
m_TagString: Attack
@@ -354,6 +355,86 @@ BoxCollider:
354355
serializedVersion: 2
355356
m_Size: {x: 2.3016863, y: 4, z: 2}
356357
m_Center: {x: 2.5958031e-14, y: 2, z: 1}
358+
--- !u!82 &82772068547145606
359+
AudioSource:
360+
m_ObjectHideFlags: 1
361+
m_PrefabParentObject: {fileID: 0}
362+
m_PrefabInternal: {fileID: 100100000}
363+
m_GameObject: {fileID: 1395668857576202}
364+
m_Enabled: 0
365+
serializedVersion: 4
366+
OutputAudioMixerGroup: {fileID: 0}
367+
m_audioClip: {fileID: 0}
368+
m_PlayOnAwake: 0
369+
m_Volume: 0.5
370+
m_Pitch: 0.81
371+
Loop: 0
372+
Mute: 0
373+
Spatialize: 0
374+
SpatializePostEffects: 0
375+
Priority: 128
376+
DopplerLevel: 1
377+
MinDistance: 1
378+
MaxDistance: 500
379+
Pan2D: 0
380+
rolloffMode: 0
381+
BypassEffects: 0
382+
BypassListenerEffects: 0
383+
BypassReverbZones: 0
384+
rolloffCustomCurve:
385+
serializedVersion: 2
386+
m_Curve:
387+
- serializedVersion: 2
388+
time: 0
389+
value: 1
390+
inSlope: 0
391+
outSlope: 0
392+
tangentMode: 0
393+
- serializedVersion: 2
394+
time: 1
395+
value: 0
396+
inSlope: 0
397+
outSlope: 0
398+
tangentMode: 0
399+
m_PreInfinity: 2
400+
m_PostInfinity: 2
401+
m_RotationOrder: 4
402+
panLevelCustomCurve:
403+
serializedVersion: 2
404+
m_Curve:
405+
- serializedVersion: 2
406+
time: 0
407+
value: 0
408+
inSlope: 0
409+
outSlope: 0
410+
tangentMode: 0
411+
m_PreInfinity: 2
412+
m_PostInfinity: 2
413+
m_RotationOrder: 0
414+
spreadCustomCurve:
415+
serializedVersion: 2
416+
m_Curve:
417+
- serializedVersion: 2
418+
time: 0
419+
value: 0
420+
inSlope: 0
421+
outSlope: 0
422+
tangentMode: 0
423+
m_PreInfinity: 2
424+
m_PostInfinity: 2
425+
m_RotationOrder: 4
426+
reverbZoneMixCustomCurve:
427+
serializedVersion: 2
428+
m_Curve:
429+
- serializedVersion: 2
430+
time: 0
431+
value: 1
432+
inSlope: 0
433+
outSlope: 0
434+
tangentMode: 0
435+
m_PreInfinity: 2
436+
m_PostInfinity: 2
437+
m_RotationOrder: 0
357438
--- !u!114 &114171811415290612
358439
MonoBehaviour:
359440
m_ObjectHideFlags: 1
@@ -372,6 +453,9 @@ MonoBehaviour:
372453
constructionAnimation: {fileID: 1930438911805690, guid: bd53f04aff03303439dc5e5a9387d182,
373454
type: 2}
374455
isUnderConstruction: 0
456+
otherConstruction: {fileID: 8300000, guid: 9709184a814296f4b9cfd8f09bd42eae, type: 3}
457+
defenseConstruction: {fileID: 8300000, guid: 1d18c24212d7dd1469e18a9abc6b39e2, type: 3}
458+
teslaConstruction: {fileID: 8300000, guid: 9709184a814296f4b9cfd8f09bd42eae, type: 3}
375459
--- !u!114 &114176782265102290
376460
MonoBehaviour:
377461
m_ObjectHideFlags: 1

0 commit comments

Comments
 (0)