Sounds added
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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
@@ -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:
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+13
@@ -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:
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user