Wizard_Of_Wak/Assets/1_Script/System/SoundBox.cs

38 lines
918 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SoundBox : MonoBehaviour
{
// TODO SoundBox 프리펩 만들어주기
//사운드를 출력을 도와주는 스크립트 입니다.
//건들이지 않는것을 추천드립니다.
AudioSource Sound;
void Awake()
{
Sound = GetComponent<AudioSource>();
}
public void PlaySound(AudioClip Clip,float v,Vector3 tr)
{
transform.position = tr;
Sound.clip = Clip;
Sound.mute = false;
Sound.volume = v;
Sound.Play();
}
public void PlaySound(AudioClip Clip, float v)
{
Sound.clip = Clip;
Sound.mute = false;
Sound.volume = v;
Sound.Play();
}
void Update()
{
if(gameObject.activeSelf && !(Sound.isPlaying))
{
SoundManager.Instance.EndSound(this);
}
}
}