1
0
Fork 0

Use the sounds (broken)

This commit is contained in:
Piegames 2018-04-23 18:52:21 +02:00
parent ace7e83ff2
commit 17e1ab02df
6 changed files with 35 additions and 7 deletions

View file

@ -57,10 +57,17 @@ public class AudioControl : MonoBehaviour
soundeffects[sound].Play(); 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(); soundeffects[sound].Stop();
} }
public bool SfxPlaying(int sound) public bool SfxPlaying(int sound)
{ {
return soundeffects[sound].isPlaying; return soundeffects[sound].isPlaying;

View file

@ -27,13 +27,13 @@ namespace Assets.Scripts.Entities.Attack {
public void Attack() { public void Attack() {
if ( bulletPrefab == null ) if ( bulletPrefab == null )
return; return;
GameObject b = GameObject.Instantiate(bulletPrefab); GameObject b = UnityEngine.Object.Instantiate(bulletPrefab);
b.transform.rotation = spawn.rotation; b.transform.rotation = spawn.rotation;
b.transform.position = spawn.position; b.transform.position = spawn.position;
Bullet bu = b.GetComponent<Bullet>(); Bullet bu = b.GetComponent<Bullet>();
bu.SetDamage(damage); bu.SetDamage(damage);
bu.SetOwner(owner); bu.SetOwner(owner);
GameController.instance.GetAudioControl().SfxPlay(0); GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.shoot);
} }
public float GetCooldownTime() { public float GetCooldownTime() {

View file

@ -31,7 +31,9 @@ public abstract class Mob : Entity {
if ( !isDead && currentHP <= 0 ) { if ( !isDead && currentHP <= 0 ) {
isDead = true; isDead = true;
Death(); Death();
} } else if (! isDead) {
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.mobattack);
}
} }
/// <summary> /// <summary>
@ -39,7 +41,8 @@ public abstract class Mob : Entity {
/// </summary> /// </summary>
protected virtual void Death() { protected virtual void Death() {
if ( objective != null ) if ( objective != null )
objective.RemoveEntity(this); objective.RemoveEntity(this);
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.explosion);
Destroy(gameObject); Destroy(gameObject);
} }

View file

@ -106,7 +106,8 @@ public class Room : MonoBehaviour {
public void Lock() { public void Lock() {
foreach ( Door d in doors ) { foreach ( Door d in doors ) {
d.Lock(); d.Lock();
} }
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.door);
Debug.Log("[ROOMS] Locked all doors..."); Debug.Log("[ROOMS] Locked all doors...");
} }
@ -116,7 +117,8 @@ public class Room : MonoBehaviour {
public void Unlock() { public void Unlock() {
foreach ( Door d in doors ) { foreach ( Door d in doors ) {
d.Unlock(); d.Unlock();
} }
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.door);
Debug.Log("[ROOMS] Unlocked all doors..."); Debug.Log("[ROOMS] Unlocked all doors...");
} }

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9ec323b9157704d00a3409f8ea6e46b2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: df6e7833427b5497b92308fb6f54e552
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: