Commit aa0697b2 by Tim Reiter

added soundFX.

parent 75751602
fileFormatVersion: 2
guid: fe442b4568795a94c8327ef28bb388b4
folderAsset: yes
timeCreated: 1433598531
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 87d31f57c51ee3a42985a8f7ef54f77f
timeCreated: 1433598603
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 3a2767fa6da7b564887c9cf40d3b6f9a
timeCreated: 1433598585
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 97fb99f55e18a9e4fa84f0054f1e4281
timeCreated: 1433602456
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: e4f13686517c0734ca2362f496cb405f
timeCreated: 1433600651
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 4ee1edfc735b1f646ba8200834e745f3
timeCreated: 1433598596
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9e5aade7838e31749993078c848ad790
timeCreated: 1433600247
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 742969351bb13d04faa141d19749c18a
timeCreated: 1433601206
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: e7af16f8b2c0b944fab421ed78706bf3
timeCreated: 1433602165
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 88fb89e353862cb4987ee6fcfbc0a280
timeCreated: 1433601512
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 80bfcb107f4a47141886fc8fc0fad3c4
timeCreated: 1433599789
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
...@@ -8,6 +8,13 @@ public class Bullet : MonoBehaviour ...@@ -8,6 +8,13 @@ public class Bullet : MonoBehaviour
public bool destroyTrap = false; public bool destroyTrap = false;
public int speed = 5; public int speed = 5;
private AudioSource audioShoot;
public AudioSource audioHit;
void Start()
{
audioShoot = GetComponent<AudioSource>();
}
/// <summary> /// <summary>
/// Das aufrufen, wenn die Kugel wirklich losgeschossen werden soll. /// Das aufrufen, wenn die Kugel wirklich losgeschossen werden soll.
...@@ -16,6 +23,7 @@ public class Bullet : MonoBehaviour ...@@ -16,6 +23,7 @@ public class Bullet : MonoBehaviour
public void shoot(Vector2 direction) public void shoot(Vector2 direction)
{ {
GetComponent<Rigidbody2D>().velocity = (float)speed * direction.normalized; GetComponent<Rigidbody2D>().velocity = (float)speed * direction.normalized;
if(audioShoot)audioShoot.Play();
} }
void OnTriggerEnter2D(Collider2D other) void OnTriggerEnter2D(Collider2D other)
...@@ -26,8 +34,9 @@ public class Bullet : MonoBehaviour ...@@ -26,8 +34,9 @@ public class Bullet : MonoBehaviour
} }
else if (healingPoints > 0 && other.tag == "Player") else if (healingPoints > 0 && other.tag == "Player")
{ {
if (audioHit) audioHit.Play();
other.GetComponent<PlayerHealth>().changeHealthBy(healingPoints); other.GetComponent<PlayerHealth>().changeHealthBy(healingPoints);
Destroy(gameObject); Invoke("destroy", 0.15f);
} }
else if (destroyTrap && other.tag == "Trap") else if (destroyTrap && other.tag == "Trap")
{ {
...@@ -37,4 +46,9 @@ public class Bullet : MonoBehaviour ...@@ -37,4 +46,9 @@ public class Bullet : MonoBehaviour
} }
} }
void destroy()
{
Destroy(gameObject);
}
} }
...@@ -17,11 +17,13 @@ public class FireScript : MonoBehaviour ...@@ -17,11 +17,13 @@ public class FireScript : MonoBehaviour
public float relayDelay = 0.25f; public float relayDelay = 0.25f;
private bool canRelay = true; private bool canRelay = true;
private AudioSource pickupAudio;
void Start() void Start()
{ {
startScale = transform.localScale; startScale = transform.localScale;
spawnPosition = transform.position; spawnPosition = transform.position;
pickupAudio = GetComponent<AudioSource>();
} }
// Update is called once per frame // Update is called once per frame
...@@ -44,6 +46,7 @@ public class FireScript : MonoBehaviour ...@@ -44,6 +46,7 @@ public class FireScript : MonoBehaviour
transform.localScale = startScale; transform.localScale = startScale;
canRelay = false; canRelay = false;
Invoke("enableRelay", relayDelay); Invoke("enableRelay", relayDelay);
if (pickupAudio) pickupAudio.Play();
} }
} }
......
...@@ -5,10 +5,13 @@ using GamepadInput; ...@@ -5,10 +5,13 @@ using GamepadInput;
public class PlayerControl : MonoBehaviour public class PlayerControl : MonoBehaviour
{ {
#region members
private Rigidbody2D body2D; private Rigidbody2D body2D;
private Transform deleteAllChildrenAtRestart; private Transform deleteAllChildrenAtRestart;
public Transform groundCheck; public Transform groundCheck;
public LayerMask mask; public LayerMask mask;
private AudioSource swishAudio;
public AudioSource dashHitAudio;
// movement config // movement config
public float pushForce = 5f; public float pushForce = 5f;
...@@ -53,11 +56,12 @@ public class PlayerControl : MonoBehaviour ...@@ -53,11 +56,12 @@ public class PlayerControl : MonoBehaviour
public PlayerInputMapping inputMapping; public PlayerInputMapping inputMapping;
public Animator dashAnimator; public Animator dashAnimator;
#endregion
void Start() void Start()
{ {
body2D = GetComponent<Rigidbody2D>(); body2D = GetComponent<Rigidbody2D>();
deleteAllChildrenAtRestart = GameObject.Find("ObjectsToDeleteAtRestart").transform; deleteAllChildrenAtRestart = GameObject.Find("ObjectsToDeleteAtRestart").transform;
swishAudio = GetComponent<AudioSource>();
} }
public void init(int playerNumber) public void init(int playerNumber)
...@@ -82,6 +86,8 @@ public class PlayerControl : MonoBehaviour ...@@ -82,6 +86,8 @@ public class PlayerControl : MonoBehaviour
other.setPushSpeed(currentDashDirection * pushForce); other.setPushSpeed(currentDashDirection * pushForce);
lastDashStart = Time.time - dashCompletionTime; lastDashStart = Time.time - dashCompletionTime;
currentDashCoolDown = dashCollisionCoolDown; currentDashCoolDown = dashCollisionCoolDown;
if (dashHitAudio) dashHitAudio.Play();
} }
private void setPushSpeed(Vector2 pushSpeed) private void setPushSpeed(Vector2 pushSpeed)
...@@ -108,6 +114,7 @@ public class PlayerControl : MonoBehaviour ...@@ -108,6 +114,7 @@ public class PlayerControl : MonoBehaviour
//dash effect: //dash effect:
dashAnimator.transform.rotation = Quaternion.FromToRotation(Vector2.right, (Vector2) currentDashDirection); dashAnimator.transform.rotation = Quaternion.FromToRotation(Vector2.right, (Vector2) currentDashDirection);
dashAnimator.SetTrigger("play"); dashAnimator.SetTrigger("play");
if (swishAudio) swishAudio.Play();
} }
if (isDashing()) if (isDashing())
......
...@@ -14,11 +14,18 @@ public class PowerUpScript : MonoBehaviour ...@@ -14,11 +14,18 @@ public class PowerUpScript : MonoBehaviour
public float respawnTime = 5.0f; public float respawnTime = 5.0f;
// used to store the position while the trap is deactivated // used to store the position while the trap is deactivated
private Vector2 realPosition; private Vector2 realPosition;
private AudioSource pickupAudio;
void Start()
{
pickupAudio = GetComponent<AudioSource>();
}
void OnTriggerEnter2D(Collider2D other) void OnTriggerEnter2D(Collider2D other)
{ {
if (other.tag == "Player") if (other.tag == "Player")
{ {
if (pickupAudio) pickupAudio.Play();
other.GetComponent<PlayerControl>().setPowerUpType(type); other.GetComponent<PlayerControl>().setPowerUpType(type);
destroyPowerUp(); destroyPowerUp();
} }
......
...@@ -15,13 +15,17 @@ public class Rocket : MonoBehaviour ...@@ -15,13 +15,17 @@ public class Rocket : MonoBehaviour
public Animator explosionAnimator; public Animator explosionAnimator;
private GameObject explosion; private GameObject explosion;
private Transform objectsToDeleteAtRestart; private Transform objectsToDeleteAtRestart;
private AudioSource hitAudio;
public AudioSource flyAudio;
#endregion #endregion
// Use this for initialization // Use this for initialization
void Start() void Start()
{ {
hitAudio = GetComponent<AudioSource>();
body = GetComponent<Rigidbody2D>(); body = GetComponent<Rigidbody2D>();
objectsToDeleteAtRestart = GameObject.Find("ObjectsToDeleteAtRestart").transform; objectsToDeleteAtRestart = GameObject.Find("ObjectsToDeleteAtRestart").transform;
if(flyAudio)flyAudio.Play();
} }
// Update is called once per frame // Update is called once per frame
...@@ -50,6 +54,9 @@ public class Rocket : MonoBehaviour ...@@ -50,6 +54,9 @@ public class Rocket : MonoBehaviour
explosion = GameObject.Instantiate(explosionAnimator.gameObject, transform.position, transform.rotation) as GameObject; explosion = GameObject.Instantiate(explosionAnimator.gameObject, transform.position, transform.rotation) as GameObject;
explosion.transform.parent = objectsToDeleteAtRestart; explosion.transform.parent = objectsToDeleteAtRestart;
if (flyAudio) flyAudio.Stop();
hitAudio.Play();
gameObject.GetComponent<SpriteRenderer>().enabled = false; gameObject.GetComponent<SpriteRenderer>().enabled = false;
gameObject.GetComponent<Collider2D>().enabled = false; gameObject.GetComponent<Collider2D>().enabled = false;
......
...@@ -15,11 +15,13 @@ public class ShieldScript : MonoBehaviour ...@@ -15,11 +15,13 @@ public class ShieldScript : MonoBehaviour
public float relayDelay = 0.25f; public float relayDelay = 0.25f;
private bool canRelay = true; private bool canRelay = true;
public AudioSource pickupAudio;
// Use this for initialization // Use this for initialization
void Start() void Start()
{ {
spawnPosition = transform.position; spawnPosition = transform.position;
pickupAudio = GetComponent<AudioSource>();
} }
void OnTriggerEnter2D(Collider2D other) void OnTriggerEnter2D(Collider2D other)
...@@ -35,6 +37,7 @@ public class ShieldScript : MonoBehaviour ...@@ -35,6 +37,7 @@ public class ShieldScript : MonoBehaviour
parentHealth.setShield(true); parentHealth.setShield(true);
canRelay = false; canRelay = false;
Invoke("enableRelay", relayDelay); Invoke("enableRelay", relayDelay);
if (pickupAudio) pickupAudio.Play();
} }
if (oldHealth != null && oldHealth != parentHealth) oldHealth.setShield(false); if (oldHealth != null && oldHealth != parentHealth) oldHealth.setShield(false);
......
...@@ -16,6 +16,7 @@ public class Trap : MonoBehaviour ...@@ -16,6 +16,7 @@ public class Trap : MonoBehaviour
private Animator destroyedEffect; private Animator destroyedEffect;
private Transform deleteAllChildrenAtRestart; private Transform deleteAllChildrenAtRestart;
private AudioSource audioHit;
void Start() void Start()
{ {
...@@ -26,6 +27,8 @@ public class Trap : MonoBehaviour ...@@ -26,6 +27,8 @@ public class Trap : MonoBehaviour
destroyedEffect = (GameObject.Instantiate(destroyedEffectPrefab, transform.position, transform.rotation) as GameObject).GetComponent<Animator>(); destroyedEffect = (GameObject.Instantiate(destroyedEffectPrefab, transform.position, transform.rotation) as GameObject).GetComponent<Animator>();
destroyedEffect.transform.parent = deleteAllChildrenAtRestart.transform; destroyedEffect.transform.parent = deleteAllChildrenAtRestart.transform;
audioHit = GetComponent<AudioSource>();
} }
void OnTriggerEnter2D(Collider2D other) void OnTriggerEnter2D(Collider2D other)
...@@ -34,6 +37,7 @@ public class Trap : MonoBehaviour ...@@ -34,6 +37,7 @@ public class Trap : MonoBehaviour
{ {
other.GetComponent<PlayerHealth>().changeHealthBy(-damagePoints); other.GetComponent<PlayerHealth>().changeHealthBy(-damagePoints);
hitEffect.SetTrigger("play"); //play animation. hitEffect.SetTrigger("play"); //play animation.
if(audioHit) audioHit.Play();
destroyTrap(); destroyTrap();
} }
} }
......
...@@ -5,6 +5,12 @@ public class TrapDestroyer : MonoBehaviour ...@@ -5,6 +5,12 @@ public class TrapDestroyer : MonoBehaviour
{ {
public float respawnTime = 5.0f; public float respawnTime = 5.0f;
private Vector2 realPosition; private Vector2 realPosition;
private AudioSource audio;
void Start()
{
audio = GetComponent<AudioSource>();
}
void OnTriggerEnter2D(Collider2D other) void OnTriggerEnter2D(Collider2D other)
{ {
...@@ -31,6 +37,7 @@ public class TrapDestroyer : MonoBehaviour ...@@ -31,6 +37,7 @@ public class TrapDestroyer : MonoBehaviour
if (bestTrap != null) if (bestTrap != null)
{ {
bestTrap.GetComponent<Trap>().destroyTrapWithEffect(); bestTrap.GetComponent<Trap>().destroyTrapWithEffect();
if(audio)audio.Play();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment