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();
}
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;

View file

@ -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<Bullet>();
bu.SetDamage(damage);
bu.SetOwner(owner);
GameController.instance.GetAudioControl().SfxPlay(0);
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.shoot);
}
public float GetCooldownTime() {

View file

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

View file

@ -107,6 +107,7 @@ public class Room : MonoBehaviour {
foreach ( Door d in doors ) {
d.Lock();
}
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.door);
Debug.Log("[ROOMS] Locked all doors...");
}
@ -117,6 +118,7 @@ public class Room : MonoBehaviour {
foreach ( Door d in doors ) {
d.Unlock();
}
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.door);
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: