public static OBJECT ToObject(string value) { OBJECT retval; if (SEType.TryParse_OBJECT(value, out retval)) { return(retval); } return(OBJECT.Null); }
/// <summary> /// 音を鳴らす /// 位置を渡すとそこを起点として鳴る /// </summary> /// <param name="type"></param> /// <param name="position"></param> public void PlaySE(SEType type, Vector3 position) { int _type = (int)type; if (type < SEType.SEMAX && Clip_se[_type] != null) { var s = GetNonusedAudioSource(); s.transform.position = position; s.PlayOneShot(Clip_se[_type]); } }
public AudioSource PlaySE(SEType type, bool isLoop = false) { AudioSource se = new GameObject(type.ToString()).AddComponent <AudioSource>(); se.clip = SEList[(int)type]; se.gameObject.AddComponent <SEScript>(); se.loop = isLoop; se.Play(); return(se); }
/// <summary> /// SEを再生するが、編集可能 /// </summary> /// <param name="type">SEの内容</param> /// <returns>再生されているSE</returns> public static AudioSource Play(SEType type) { AudioSource src = new GameObject("[Audio SE - " + type.ToString() + " - Editable]").AddComponent <AudioSource>(); src.transform.SetParent(myManager.transform); src.clip = SEclips[(int)type]; src.outputAudioMixerGroup = mixerGroups[0]; src.Play(); return(src); }
/// <summary> /// SEを再生する /// </summary> /// <param name="type">SEの内容</param> /// <param name="vol">音量</param> public static void Play(SEType type, float vol) { AudioSource src = new GameObject("[Audio SE - " + type.ToString() + "]").AddComponent <AudioSource>(); src.transform.SetParent(myManager.transform); src.clip = SEclips[(int)type]; src.volume = vol; src.outputAudioMixerGroup = mixerGroups[0]; src.Play(); Destroy(src.gameObject, SEclips[(int)type].length + 0.1f); }
AudioSource _Play(SEType type, float vol, bool autoDelete) { AudioSource src = new GameObject("[Audio SE - " + type.ToString() + "]").AddComponent <AudioSource>(); src.transform.SetParent(myManager.transform); src.clip = SEclips[(int)type]; src.volume = vol; src.outputAudioMixerGroup = mixerGroups[0]; src.Play(); if (autoDelete) { Destroy(src.gameObject, SEclips[(int)type].length + 0.1f); } return(src); }
public static Vector3 ToVector(VarScope vs, string value) { Vector3 retval; if (vs != null) { string varname = GetVarName(value); if (varname != null) { value = vs[varname].data; } } if (SEType.TryParse_VECTOR(value, out retval)) { return(retval); } return(Vector3.zero); }
public static DIRRANGE ToDirRange(VarScope vs, string value) { DIRRANGE retval; if (vs != null) { string varname = GetVarName(value); if (varname != null) { value = vs[varname].data; } } if (SEType.TryParse_DIRRANGE(value, out retval)) { return(retval); } return(DIRRANGE.nodir); }
public static RANGE ToRange(VarScope vs, string value) { RANGE retval; if (vs != null) { string varname = GetVarName(value); if (varname != null) { value = vs[varname].data; } } if (SEType.TryParse_RANGE(value, out retval)) { return(retval); } return(RANGE.nowhere); }
public static Color ToColor(VarScope vs, string value) { Color32 retval; if (vs != null) { string varname = GetVarName(value); if (varname != null) { value = vs[varname].data; } } if (SEType.TryParse_COLOR(value, out retval)) { return((Color)retval); } return(Color.white); }
public static Rect ToRect(VarScope vs, string value) { Rect retval; if (vs != null) { string varname = GetVarName(value); if (varname != null) { value = vs[varname].data; } } if (SEType.TryParse_RECT(value, out retval)) { return(retval); } return(new Rect(0, 0, 0, 0)); }
//AudioSoureを取得する AudioSource GetAudioSource(SEType type, int channel = 1) { if (_object == null) { //ゲームオブジェクトがなければ作る _object = new GameObject("Sound"); //廃棄しないようにする GameObject.DontDestroyOnLoad(_object); //AudioSourceを作成 bgm = _object.AddComponent <AudioSource>(); SEDefault = _object.AddComponent <AudioSource>(); for (int i = 0; i < SE_CHANNEL; i++) { SEArray[i] = _object.AddComponent <AudioSource>(); } } if (type == SEType.BGM) { //BGM return(bgm); } else { //SE if (0 <= channel && channel < SE_CHANNEL) { //チャンネルの指定 return(SEArray[channel]); } else { //デフォルト return(SEDefault); } } }
public static AudioSource Play(SEType type, float vol, bool autoDelete) { return(myManager._Play(type, vol, autoDelete)); }
AudioClip GetClip(SEType type) { return(clips.Find(c => c.type == type).audio); }
/// <summary> /// 遅延してSEを鳴らす /// </summary> /// <param name="seType"></param> /// <param name="delayTime"></param> public void PlaySE(SEType seType, Vector3 position, float delayTime) { StartCoroutine(IEPlaySEDelay(seType, position, delayTime)); }
public void PlaySE(SEType type) { audioSource.PlayOneShot(soundSEList[type]); }
public void Play(SEType type) { audioSource.Stop(); audioSource.PlayOneShot(GetClip(type)); }
public void PlaySE(SEType type) { _seAudioSource.PlayOneShot(_seList[type]); }
/// <summary> /// SEを再生する /// </summary> /// <param name="type">SEの内容</param> /// <param name="vol">音量</param> public static AudioSource Play(SEType type) { return(myManager._Play(type, 1.0f, true)); }
public void Play(SEType type, float deley) { tween.Kill(); tween = DOVirtual.DelayedCall(deley, () => Play(type)); }
/// <summary> /// 音を鳴らす /// 位置を渡すとそこを起点として鳴る /// </summary> /// <param name="type"></param> /// <param name="position"></param> //public void PlaySELoop(SEType type, Vector3 position, float looptime) { // int _type = (int)type; // if (type < SEType.SEMAX && Clip_se[_type] != null) { // var s = GetNonusedAudioSource(); // s.transform.position = position; // s.PlayOneShot(Clip_se[_type]); // } //} IEnumerator IEPlaySEDelay(SEType seType, Vector3 position, float delayTime) { yield return(new WaitForSeconds(delayTime)); PlaySE(seType, position); }
public static AudioSource Play(SEType type, float vol) { return(myManager._Play(type, vol, true)); }