Add sound effects
This commit is contained in:
@@ -21,6 +21,7 @@ public class GameManager : MonoBehaviour
|
|||||||
public MusicManager musicManager;
|
public MusicManager musicManager;
|
||||||
public Player player;
|
public Player player;
|
||||||
public GameObject[] pickups;
|
public GameObject[] pickups;
|
||||||
|
public AudioSource enemyConsumedSfx;
|
||||||
|
|
||||||
[Header("Timing")]
|
[Header("Timing")]
|
||||||
public float pickupDelay;
|
public float pickupDelay;
|
||||||
@@ -57,6 +58,10 @@ public class GameManager : MonoBehaviour
|
|||||||
|
|
||||||
public void StartWave()
|
public void StartWave()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//increase player speed
|
||||||
|
player.speed += player.speedIncrease;
|
||||||
|
|
||||||
if (wave >= waves.Count)
|
if (wave >= waves.Count)
|
||||||
{
|
{
|
||||||
wave = 0;
|
wave = 0;
|
||||||
@@ -84,7 +89,10 @@ public class GameManager : MonoBehaviour
|
|||||||
|
|
||||||
Vector3 spawnPos = new Vector3(spawnX, player.gameObject.transform.position.y, spawnZ);
|
Vector3 spawnPos = new Vector3(spawnX, player.gameObject.transform.position.y, spawnZ);
|
||||||
|
|
||||||
GameObject obj = Instantiate(currentWave.enemies[i].gameObject, spawnPos, Quaternion.identity, enemyHolder.transform);
|
//vector3 to quaternion
|
||||||
|
Quaternion spawnRot = Quaternion.Euler(90, 0, 0);
|
||||||
|
|
||||||
|
GameObject obj = Instantiate(currentWave.enemies[i].gameObject, spawnPos, spawnRot, enemyHolder.transform);
|
||||||
obj.SetActive(true);
|
obj.SetActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,6 +103,8 @@ public class GameManager : MonoBehaviour
|
|||||||
enemiesConsumed++;
|
enemiesConsumed++;
|
||||||
|
|
||||||
IncrementScore(10, multiplier);
|
IncrementScore(10, multiplier);
|
||||||
|
//play enemy consumed sound
|
||||||
|
enemyConsumedSfx.Play();
|
||||||
|
|
||||||
if (enemiesConsumed == currentWave.enemies.Count)
|
if (enemiesConsumed == currentWave.enemies.Count)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,15 +4,34 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class MusicManager : MonoBehaviour
|
public class MusicManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public AudioClip[] tracks;
|
||||||
|
public AudioClip highTensionClip;
|
||||||
|
public int currentTrack = 0;
|
||||||
|
public Player player;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
//if track is finished play next track
|
||||||
|
if (!GetComponent<AudioSource>().isPlaying)
|
||||||
|
{
|
||||||
|
GetComponent<AudioSource>().clip = tracks[currentTrack];
|
||||||
|
GetComponent<AudioSource>().Play();
|
||||||
|
currentTrack = (currentTrack + 1) % tracks.Length -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.health <= 15 && GetComponent<AudioSource>().clip != highTensionClip)
|
||||||
|
{
|
||||||
|
GetComponent<AudioSource>().clip = highTensionClip;
|
||||||
|
GetComponent<AudioSource>().Play();
|
||||||
|
GetComponent<AudioSource>().loop = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
Assets/Sfx.meta
Normal file
8
Assets/Sfx.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6df23f938a65b474eb02c77256d05ce5
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/Sfx/Music.meta
Normal file
8
Assets/Sfx/Music.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d106326b060814b42abd9bad3ee96897
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Sfx/Music/388101__furbyguy__90-s-game-loop.wav
(Stored with Git LFS)
Normal file
BIN
Assets/Sfx/Music/388101__furbyguy__90-s-game-loop.wav
(Stored with Git LFS)
Normal file
Binary file not shown.
22
Assets/Sfx/Music/388101__furbyguy__90-s-game-loop.wav.meta
Normal file
22
Assets/Sfx/Music/388101__furbyguy__90-s-game-loop.wav.meta
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7ed48555d2396e944ad0c62c157c559c
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 6
|
||||||
|
defaultSettings:
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
preloadAudioData: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Sfx/Music/mezhdunami-flashes-95436.mp3
(Stored with Git LFS)
Normal file
BIN
Assets/Sfx/Music/mezhdunami-flashes-95436.mp3
(Stored with Git LFS)
Normal file
Binary file not shown.
22
Assets/Sfx/Music/mezhdunami-flashes-95436.mp3.meta
Normal file
22
Assets/Sfx/Music/mezhdunami-flashes-95436.mp3.meta
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 87bfa63b91a7cd6428d3b6da059e8af7
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 6
|
||||||
|
defaultSettings:
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
preloadAudioData: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Sfx/Music/neon-dreams-vice-city-theme--8681.mp3
(Stored with Git LFS)
Normal file
BIN
Assets/Sfx/Music/neon-dreams-vice-city-theme--8681.mp3
(Stored with Git LFS)
Normal file
Binary file not shown.
22
Assets/Sfx/Music/neon-dreams-vice-city-theme--8681.mp3.meta
Normal file
22
Assets/Sfx/Music/neon-dreams-vice-city-theme--8681.mp3.meta
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f171d586b43ad8140912defda8b14bfd
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 6
|
||||||
|
defaultSettings:
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
preloadAudioData: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
1
Assets/Sfx/Powerup7.bfxrsound
Normal file
1
Assets/Sfx/Powerup7.bfxrsound
Normal file
@@ -0,0 +1 @@
|
|||||||
|
2,0.5,,0.0974,,0.39,0.3,0.2525,,0.2285,,,,,,,,,,,0.164,,,,,1,,,,,,,masterVolume
|
||||||
7
Assets/Sfx/Powerup7.bfxrsound.meta
Normal file
7
Assets/Sfx/Powerup7.bfxrsound.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3a6449c2206cb1e4488a5dd34ab7ead1
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Sfx/Powerup7.wav
(Stored with Git LFS)
Normal file
BIN
Assets/Sfx/Powerup7.wav
(Stored with Git LFS)
Normal file
Binary file not shown.
22
Assets/Sfx/Powerup7.wav.meta
Normal file
22
Assets/Sfx/Powerup7.wav.meta
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 96df4f90a33ad024faa7e8b26b155604
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 6
|
||||||
|
defaultSettings:
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
preloadAudioData: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Sfx/brrrp
Normal file
BIN
Assets/Sfx/brrrp
Normal file
Binary file not shown.
7
Assets/Sfx/brrrp.meta
Normal file
7
Assets/Sfx/brrrp.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ad3554c84308c394bab105d1474f2d3e
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Sfx/pos.wav
(Stored with Git LFS)
Normal file
BIN
Assets/Sfx/pos.wav
(Stored with Git LFS)
Normal file
Binary file not shown.
22
Assets/Sfx/pos.wav.meta
Normal file
22
Assets/Sfx/pos.wav.meta
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ea034a309d81f3241955cb8cc7525dc0
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 6
|
||||||
|
defaultSettings:
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
preloadAudioData: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user