Exemplo n.º 1
0
        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]);
            }
        }
Exemplo n.º 3
0
    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);
    }
Exemplo n.º 4
0
    /// <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);
    }
Exemplo n.º 5
0
    /// <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);
    }
Exemplo n.º 6
0
    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);
    }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
        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));
        }
Exemplo n.º 12
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);
         }
     }
 }
Exemplo n.º 13
0
 public static AudioSource Play(SEType type, float vol, bool autoDelete)
 {
     return(myManager._Play(type, vol, autoDelete));
 }
Exemplo n.º 14
0
 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));
 }
Exemplo n.º 16
0
 public void PlaySE(SEType type)
 {
     audioSource.PlayOneShot(soundSEList[type]);
 }
Exemplo n.º 17
0
 public void Play(SEType type)
 {
     audioSource.Stop();
     audioSource.PlayOneShot(GetClip(type));
 }
Exemplo n.º 18
0
 public void PlaySE(SEType type)
 {
     _seAudioSource.PlayOneShot(_seList[type]);
 }
Exemplo n.º 19
0
 /// <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));
 }
Exemplo n.º 20
0
 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);
        }
Exemplo n.º 22
0
 public static AudioSource Play(SEType type, float vol)
 {
     return(myManager._Play(type, vol, true));
 }