using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace ET
{
[RequireComponent(typeof(AudioSource))]
public class SoundData : MonoBehaviour
{
//音频源控件
public new AudioSource audio;
///
/// 是否强制重新播放
///
//[HideInInspector]
public bool isForceReplay = false;
///
/// 是否循环播放
///
//[HideInInspector]
public bool isLoop = false;
///
/// 音量
///
//[HideInInspector]
public float volume = 1;
///
/// 延迟
///
//[HideInInspector]
public ulong delay = 0;
public AudioSource GetAudio()
{
return audio;
}
public bool IsPlaying
{
get
{
return audio != null && audio.isPlaying;
}
}
public bool IsPause
{
get;
set;
}
public void Dispose()
{
Destroy(gameObject);
}
///
/// 音效类型
///
public SoundType Sound { get; set; }
public bool Mute
{
get { return audio.mute; }
set { audio.mute = value; }
}
public float Volume
{
get { return audio.volume; }
set { audio.volume = value; }
}
}
///
/// 音效类型
///
public enum SoundType
{
Music,//长音乐
Sound,//短音乐
}
}