Audio
This commit is contained in:
parent
4125ab62bb
commit
31f549c3d5
@ -1,62 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class SoundManagerScript : MonoBehaviour
|
|
||||||
{
|
|
||||||
// Start is called before the first frame update
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
public static AudioClip BoxDrop01, BoxDrop02, ItemDrop01, ItemDrop02, ItemPickup01, ItemPickup02, Jump01, Jump02, Jump03, Lose, Push01, Theme, Win;
|
|
||||||
static AudioSource audioSrc;
|
|
||||||
|
|
||||||
ThemeSong = Audio.load<AudioClip>("Theme")
|
|
||||||
BoxDrop01Sound = Audio.load<AudioClip>("BoxDrop01")
|
|
||||||
BoxDrop02Sound = Audio.load<AudioClip>("BoxDrop02")
|
|
||||||
ItemDrop01Sound = Audio.load<AudioClip>("ItemDrop01")
|
|
||||||
ItemDrop02Sound = Audio.load<AudioClip>("ItemDrop02")
|
|
||||||
ItemPickup01Sound = Audio.load<AudioClip>("ItemPickup01")
|
|
||||||
ItemPickup02Sound = Audio.load<AudioClip>("ItemPickup02")
|
|
||||||
Jump01Sound = Audio.load<AudioClip>("Jump01")
|
|
||||||
Jump02Sound = Audio.load<AudioClip>("Jump02")
|
|
||||||
Jump03Sound = Audio.load<AudioClip>("Jump03")
|
|
||||||
LoseSound = Audio.load<AudioClip>("Lose")
|
|
||||||
Push01Sound = Audio.load<AudioClip>("Push01")
|
|
||||||
WinSound = Audio.load<AudioClip>("Win")
|
|
||||||
|
|
||||||
audiosrc = GetComponent<audiosource>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public static void PlaySound(string clip)
|
|
||||||
{
|
|
||||||
switch (clip)
|
|
||||||
{
|
|
||||||
case "BoxDrop":
|
|
||||||
audioSrc.PlayOneShot(Dropbox01 || Dropbox02 || Dropbox03);
|
|
||||||
break;
|
|
||||||
case "ItemDrop":
|
|
||||||
audioSrc.PlayOneShot(ItemDrop01 || ItemDrop02);
|
|
||||||
break;
|
|
||||||
case "ItemPickup":
|
|
||||||
audioSrc.PlayOneShot(ItemPickup01 || ItemPickup02);
|
|
||||||
break;
|
|
||||||
case "ItemDrop01":
|
|
||||||
audioSrc.PlayOneShot(ItemDrop01 || ItemDrop02);
|
|
||||||
break;
|
|
||||||
case "Jump":
|
|
||||||
audioSrc.PlayOneShot(Jump01 || Jump02);
|
|
||||||
break;
|
|
||||||
case "Lose":
|
|
||||||
audioSrc.PlayOneShot(Lose);
|
|
||||||
break;
|
|
||||||
case "win":
|
|
||||||
audioSrc.PlayOneShot(Win);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 359232fb046cb2d46bfa9649f443d567
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -12,7 +12,7 @@ public class Audiomanager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
foreach (AudioSound c in clips)
|
foreach (AudioSound c in clips)
|
||||||
{
|
{
|
||||||
c.source = gameObject.AddComponent<AudionSource>();
|
c.source = gameObject.AddComponent<AudioSource>();
|
||||||
c.source.clip = c.clip;
|
c.source.clip = c.clip;
|
||||||
c.source.volume = c.volume;
|
c.source.volume = c.volume;
|
||||||
c.source.pitch = c.pitch;
|
c.source.pitch = c.pitch;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Audio;
|
using UnityEngine.Audio;
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
public class AudioSound
|
public class AudioSound
|
||||||
{
|
{
|
||||||
public string name;
|
public string name;
|
||||||
|
Loading…
Reference in New Issue
Block a user