From 17e1ab02dfe313b7e4f76a93e3a7960ebf193629 Mon Sep 17 00:00:00 2001 From: Piegames <14054505+piegamesde@users.noreply.github.com> Date: Mon, 23 Apr 2018 18:52:21 +0200 Subject: [PATCH] Use the sounds (broken) --- Assets/Scripts/AudioControl.cs | 9 ++++++++- Assets/Scripts/Entities/Attack/SingleShot.cs | 4 ++-- Assets/Scripts/Entities/Mob.cs | 7 +++++-- Assets/Scripts/Room.cs | 6 ++++-- Assets/graphics/textures/car.meta | 8 ++++++++ Assets/graphics/textures/tmp.meta | 8 ++++++++ 6 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 Assets/graphics/textures/car.meta create mode 100644 Assets/graphics/textures/tmp.meta diff --git a/Assets/Scripts/AudioControl.cs b/Assets/Scripts/AudioControl.cs index 2df3d77..336c310 100644 --- a/Assets/Scripts/AudioControl.cs +++ b/Assets/Scripts/AudioControl.cs @@ -57,10 +57,17 @@ public class AudioControl : MonoBehaviour soundeffects[sound].Play(); } - public void SfxStop(int sound) + public void SfxPlay(Sfx sound) { + Debug.Log("Playing " + sound + " " + (int)sound); + SfxPlay((int)sound); + } + + public void SfxStop(int sound) { soundeffects[sound].Stop(); } + + public bool SfxPlaying(int sound) { return soundeffects[sound].isPlaying; diff --git a/Assets/Scripts/Entities/Attack/SingleShot.cs b/Assets/Scripts/Entities/Attack/SingleShot.cs index 88e3a50..75d0f1f 100644 --- a/Assets/Scripts/Entities/Attack/SingleShot.cs +++ b/Assets/Scripts/Entities/Attack/SingleShot.cs @@ -27,13 +27,13 @@ namespace Assets.Scripts.Entities.Attack { public void Attack() { if ( bulletPrefab == null ) return; - GameObject b = GameObject.Instantiate(bulletPrefab); + GameObject b = UnityEngine.Object.Instantiate(bulletPrefab); b.transform.rotation = spawn.rotation; b.transform.position = spawn.position; Bullet bu = b.GetComponent(); bu.SetDamage(damage); bu.SetOwner(owner); - GameController.instance.GetAudioControl().SfxPlay(0); + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.shoot); } public float GetCooldownTime() { diff --git a/Assets/Scripts/Entities/Mob.cs b/Assets/Scripts/Entities/Mob.cs index 9fab2e8..a3a8bcb 100644 --- a/Assets/Scripts/Entities/Mob.cs +++ b/Assets/Scripts/Entities/Mob.cs @@ -31,7 +31,9 @@ public abstract class Mob : Entity { if ( !isDead && currentHP <= 0 ) { isDead = true; Death(); - } + } else if (! isDead) { + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.mobattack); + } } /// @@ -39,7 +41,8 @@ public abstract class Mob : Entity { /// protected virtual void Death() { if ( objective != null ) - objective.RemoveEntity(this); + objective.RemoveEntity(this); + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.explosion); Destroy(gameObject); } diff --git a/Assets/Scripts/Room.cs b/Assets/Scripts/Room.cs index ca118f1..d3382ac 100644 --- a/Assets/Scripts/Room.cs +++ b/Assets/Scripts/Room.cs @@ -106,7 +106,8 @@ public class Room : MonoBehaviour { public void Lock() { foreach ( Door d in doors ) { d.Lock(); - } + } + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.door); Debug.Log("[ROOMS] Locked all doors..."); } @@ -116,7 +117,8 @@ public class Room : MonoBehaviour { public void Unlock() { foreach ( Door d in doors ) { d.Unlock(); - } + } + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.door); Debug.Log("[ROOMS] Unlocked all doors..."); } diff --git a/Assets/graphics/textures/car.meta b/Assets/graphics/textures/car.meta new file mode 100644 index 0000000..8504594 --- /dev/null +++ b/Assets/graphics/textures/car.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9ec323b9157704d00a3409f8ea6e46b2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/graphics/textures/tmp.meta b/Assets/graphics/textures/tmp.meta new file mode 100644 index 0000000..7ebab68 --- /dev/null +++ b/Assets/graphics/textures/tmp.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: df6e7833427b5497b92308fb6f54e552 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: