Sounds added

This commit is contained in:
Logic Monkey
2018-04-22 19:11:55 -04:00
parent c6b700f51e
commit 47713e6012
50 changed files with 1979 additions and 146 deletions
+3 -2
View File
@@ -3,7 +3,8 @@ using System.Collections.Generic;
using UnityEngine;
public class Bomb : MonoBehaviour {
Animator animator;
Animator animator;
Rigidbody2D rigidBody;
public float timer;
@@ -15,11 +16,11 @@ public class Bomb : MonoBehaviour {
public Respawner respawner; //this can be respawned
float birthTime;
void Awake() {
animator = GetComponent<Animator> ();
rigidBody = GetComponent<Rigidbody2D> ();
if (timer < 0) {
animator.enabled = false;
+23
View File
@@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ExplosionSoundManager : MonoBehaviour {
static AudioSource asrc;
// Use this for initialization
void Awake () {
if (asrc == null)
{
asrc = GetComponent<AudioSource>();
asrc.Play();
}
}
void LateUpdate () {
asrc = null;
}
}
+13
View File
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: a80a790e2417fd343a40595cca7052e2
timeCreated: 1524428442
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+29
View File
@@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LollipopSaysHi : MonoBehaviour {
float timeAccumulated;
public float timeTillWave = 10;
// Use this for initialization
Animator a;
void Start () {
timeAccumulated = Random.Range(0, timeTillWave);
a = GetComponent<Animator>();
}
// Update is called once per frame
void Update () {
timeAccumulated += Time.deltaTime;
if (timeAccumulated >= timeTillWave)
{
if (Random.Range(0, 2) == 0)
{
a.SetTrigger("SayHi");
}
timeAccumulated = 0;
}
}
}
+13
View File
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: c507cc0b3e5960d4c9c32a4f73709d14
timeCreated: 1524409809
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+12 -3
View File
@@ -21,11 +21,15 @@ public class Player : MonoBehaviour {
public GameObject icePelletPrefab;
public GameObject windPelletPrefab;
AudioSource aSource;
public AudioClip fireClip, iceClip, windClip, switchClip;
void Awake() {
animator = GetComponent<Animator> ();
rigidBody = GetComponent<Rigidbody2D> ();
witchAnimateScript = GetComponent<witchAnimate> ();
aSource = GetComponent<AudioSource>();
speed = 0.79f;
}
@@ -50,6 +54,8 @@ public class Player : MonoBehaviour {
if (deltaForce != Vector2.zero) {
lastDirection = rigidBody.velocity;
}
if (Input.GetButtonDown("Switch")) aSource.PlayOneShot(switchClip);
}
void Move() {
@@ -66,13 +72,16 @@ public class Player : MonoBehaviour {
switch (witchAnimateScript.el) {
case witchAnimate.Element.fire:
aSource.PlayOneShot(fireClip);
pellet = Instantiate (firePelletPrefab);
break;
case witchAnimate.Element.ice:
pellet = Instantiate (icePelletPrefab);
aSource.PlayOneShot(iceClip);
pellet = Instantiate (icePelletPrefab);
break;
case witchAnimate.Element.wind:
pellet = Instantiate (windPelletPrefab);
aSource.PlayOneShot(windClip);
pellet = Instantiate (windPelletPrefab);
break;
}
+7 -1
View File
@@ -10,8 +10,12 @@ public class PressurePlate : MonoBehaviour {
GameObject presser;
AudioSource asrc;
public AudioClip sound;
void Awake() {
spriteRenderer = GetComponent<SpriteRenderer> ();
asrc = GetComponent<AudioSource>();
}
void OnTriggerEnter2D(Collider2D collider) {
@@ -22,6 +26,7 @@ public class PressurePlate : MonoBehaviour {
presser = go;
pressed = true;
SwitchSprite ();
asrc.PlayOneShot(sound);
}
}
}
@@ -31,7 +36,8 @@ public class PressurePlate : MonoBehaviour {
presser = null;
pressed = false;
SwitchSprite ();
}
asrc.PlayOneShot(sound);
}
}
void SwitchSprite() {