当前位置: 首页>>代码示例>>C#>>正文


C# SoundType.ToString方法代码示例

本文整理汇总了C#中SoundType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SoundType.ToString方法的具体用法?C# SoundType.ToString怎么用?C# SoundType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SoundType的用法示例。


在下文中一共展示了SoundType.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SoundFormat

 /// <summary>
 /// Initializes new instance of SoundFormat class
 /// </summary>
 /// <param name="soundType"></param>
 /// <param name="rate"></param>
 /// <param name="channels"></param>
 public SoundFormat(SoundType soundType, int rate, int channels)
 {
     SoundType = soundType;
     Format = soundType.ToString();
     Rate = rate;
     Channels = channels;
     Init();
     BlockSize = BitsPerSample / 8 * Channels;
     UseCustomAudioRendering = true;
 }
开发者ID:jasine,项目名称:KinectExplorer,代码行数:16,代码来源:SoundFormat.cs

示例2: Trigger

	public void Trigger (SoundType type)
	{
	 	List<AudioClip> audioList = new List<AudioClip>();
		string soundType = type.ToString(); 

		foreach(AudioClip g in Resources.LoadAll("Sounds/"+soundType, typeof(AudioClip)))
		{
			audioList.Add(g);
		}
//		Debug.Log ("SoundManager.cs : Play sound " + soundType);

		AudioSource audioSource = Camera.main.GetComponent<AudioSource>();
		audioSource.clip = audioList[Random.Range(0, audioList.Count)];
		audioSource.Play();

	}
开发者ID:marcteys,项目名称:trauts,代码行数:16,代码来源:SoundManager.cs

示例3: IsPaused

    public bool IsPaused(SoundType st)
    {
        if (st == SoundType.None)
        {
            return false;
        }

        if (!sources.ContainsKey(st))
        {
            sources.Add(st, transform.FindChild(st.ToString()).GetComponent<AudioSource>());
        }
        AudioSource sound = sources[st];

        if (sound.isPlaying)
        {
            return false;
        }

        if (sound.time <= 0.1f || sound.time >= sound.clip.length - 0.1f)
        {
            return false;
        }

        return true;
    }
开发者ID:cowarrior1,项目名称:Mini_Games,代码行数:25,代码来源:AudioController.cs

示例4: IsPlaying

    public bool IsPlaying(SoundType st)
    {
        if (st == SoundType.None)
        {
            return false;
        }

        if (!sources.ContainsKey(st))
        {
            sources.Add(st, transform.FindChild(st.ToString()).GetComponent<AudioSource>());
        }
        AudioSource sound = sources[st];

        return sound.isPlaying;
    }
开发者ID:cowarrior1,项目名称:Mini_Games,代码行数:15,代码来源:AudioController.cs

示例5: Stop

    public void Stop(SoundType st)
    {
        if (st == SoundType.None)
        {
            return;
        }

        if (!sources.ContainsKey(st))
        {
            sources.Add(st, transform.FindChild(st.ToString()).GetComponent<AudioSource>());
        }
        AudioSource sound = sources[st];

        if (sound && sound.clip)
        {
            sound.Stop();
        }
    }
开发者ID:cowarrior1,项目名称:Mini_Games,代码行数:18,代码来源:AudioController.cs

示例6: Play

    public void Play(SoundType st, float delay = 0)
    {
        if (st == SoundType.None)
        {
            return;
        }

        if (!sources.ContainsKey(st))
        {
            sources.Add(st, transform.FindChild(st.ToString()).GetComponent<AudioSource>());
        }
        AudioSource sound = sources[st];

        if (sound && sound.clip)
        {
            if (delay > 0)
            {
                sound.PlayDelayed(delay);
            }
            else
            {
                sound.Play();
            }
        }
        else
        {
            if (audioLoading)
            {
                AudioLoading al = (Instantiate(audioLoading) as GameObject).transform.GetComponent<AudioLoading>();
                al.audioSource = sound;
            }
        }
    }
开发者ID:cowarrior1,项目名称:Mini_Games,代码行数:33,代码来源:AudioController.cs

示例7: PlaySound

 internal void PlaySound(SoundType _eSoundType)
 {
     m_dAudioSources[_eSoundType.ToString()].Stop();
     m_dAudioSources[_eSoundType.ToString()].Play();
 }
开发者ID:Darkfafi,项目名称:Summer_Game_Dev_2015_GameJam,代码行数:5,代码来源:SoundManager.cs

示例8: PlaySound

    private void PlaySound(int sound, float spatialBlend, SoundType type, Transform location)
    {
        if (sound >= soundDB.Length)
        {
            Debug.Log("ERROR: ID Number is larger than Sound Database! Nothing will be played.");
            return;
        }
        AudioSource source = GetNextAvailableAudioSource();
        source.clip = soundDB[sound];
        source.spatialBlend = spatialBlend;
        
        //Assign Audiomixer that audiosource points to
        switch (type)
        {
            case SoundType._2dSound:
                source.outputAudioMixerGroup = SoundChannel("GameWorld");
                break;
            case SoundType._3dSound:
                source.outputAudioMixerGroup = SoundChannel("GameWorld");
                break;
            case SoundType._UISound:
                source.outputAudioMixerGroup = SoundChannel("UI");
                break;
            case SoundType.noType:
                source.outputAudioMixerGroup = SoundChannel("other");
                break;
            default:
                Debug.Log("SoundMaster.PlaySound doesn't have SoundType" + type.ToString() + " tied to an AudioMixerGroup");
                break;
        }

        source.Play();
        
        if(source.gameObject.name == "BackupSoundPlayer")
        {
            Destroy(source.gameObject, source.clip.length + 1f);
        }

        //If there's a SoundPlayer class attached to audiosource's gameobject, have it follow
        SoundPlayer supportClass = source.gameObject.GetComponent<SoundPlayer>();
        if (supportClass != null)
            supportClass.Follow(location);
    }
开发者ID:Ammypendent,项目名称:GGJ16-OvernightDelivery,代码行数:43,代码来源:SoundMaster.cs


注:本文中的SoundType.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。