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


C# AudioSource.PlayDelayed方法代码示例

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


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

示例1: AudioPlayer

    public AudioPlayer(AudioObject audio)
    {
        if (audio == null || audio.parent == null)
        {
            removable = true;
            return;
        }
        this.finished = false;
        this.removable = false;
        this.paused = false;
        this.audio = audio;

        // create audio source with clip
        audioGO = (GameObject)GameObject.Instantiate(AudioManager.instance.audioSourcePrefab);
        //Debug.Log(audio.parent);
        audioGO.transform.parent = audio.parent.transform;
        audioGO.transform.localPosition = Vector3.zero;

        SoundSystemManager.HandleAudioSource(audioGO);

        audioAS = audioGO.GetComponent<AudioSource>();
        audioAS.Stop();
        audioAS.clip = audio.clip;
        audioAS.volume = audio.volume;
        audioAS.loop = audio.loop;
        if (audio.maxDistance.HasValue)
            audioAS.maxDistance = audio.maxDistance.Value;
        if (audio.minDistance.HasValue)
            audioAS.minDistance = audio.minDistance.Value;

        playAtTime = Time.time + audio.delay;
        audioAS.PlayDelayed(audio.delay);
    }
开发者ID:ChielBruin,项目名称:legend-of-iris,代码行数:33,代码来源:AudioPlayer.cs

示例2: Start

 // Use this for initialization
 void Start()
 {
     _exterminate = GetComponent<AudioSource>();
     _exterminate.pitch += Random.Range(-0.1F, 0.8F);
     _speakingFrequency = Random.Range(2F, 5F);
     _exterminate.PlayDelayed(_speakingFrequency);
 }
开发者ID:actuallymentor,项目名称:unity-tower-defense,代码行数:8,代码来源:SayExterminate.cs

示例3: Start

 // Use this for initialization
 void Start()
 {
     musicSrc = transform.FindChild("Music").GetComponent<AudioSource>();
     ambienceSrc = transform.FindChild("Ambience").GetComponent<AudioSource>();
     onPuzzleCompletionSrc = transform.FindChild("OnPuzzleCompletion").GetComponent<AudioSource>();
     if(playMusicDelay != 0f)
         musicSrc.PlayDelayed(playMusicDelay);
 }
开发者ID:rstaewen,项目名称:Pharos,代码行数:9,代码来源:SoundControl.cs

示例4: Start

 // Use this for initialization
 void Start()
 {
     audio1 = GetComponent<AudioSource>();
     audio1.PlayDelayed(Random.Range(0F, 3.0F));
     audio1.pitch = audio1.pitch + Random.Range(-3F, 3.0F);
     x = transform.position.x;
     y = transform.position.y;
     z = transform.position.z;
 }
开发者ID:vvolis,项目名称:Prototype_dump,代码行数:10,代码来源:TreeBranch.cs

示例5: LoadClip

 public static IEnumerator LoadClip(AudioSource audioSource)
 {
     WWW www = new WWW("file://" + tempFolder + "output.wav");
     while (!www.isDone)
         yield return www;
     AudioClip clip = www.GetAudioClip(false);
     audioSource.clip = clip;
     if (clip.length > 0)
         audioSource.PlayDelayed(0.02f);
 }
开发者ID:RuslanAhmetsharipov,项目名称:TalkingHead,代码行数:10,代码来源:AnimationController.cs

示例6: Start

    // Use this for initialization
    void Start()
    {
        //audio.PlayDelayed(5);

        audioinicio = (AudioSource)gameObject.AddComponent ("AudioSource");
        AudioClip myAudioClip;

        audioinicio.clip = audiofile;
        audioinicio.loop = false;
        audioinicio.PlayDelayed (3);
    }
开发者ID:georgex1,项目名称:zurich_oculus,代码行数:12,代码来源:playaudio.cs

示例7: Start

	// Use this for initialization
	void Start () 
	{
		sfx = variety[Random.Range(0, variety.Length)];
		sfx.PlayDelayed(0.3f);
		Destroy(gameObject, 1.0f);
	}
开发者ID:JPStank,项目名称:CRISPY_Samurai,代码行数:7,代码来源:SoundEffect.cs

示例8: TurnSound

	void TurnSound ( AudioSource sound, float pitchRange, float avgRateEst, float rateMax, float accel ) {
		if ( avgRateEst > accel * .03f ) {
			if ( sound.isPlaying == false ) {
				sound.PlayDelayed(.1f);
			}
			sound.pitch = 1f + (( (avgRateEst - (rateMax * .5f)) / rateMax ) * (pitchRange * 2f)); 
		} else {
			sound.Stop();
		}
	}
开发者ID:andrewstarnes,项目名称:wwtd2,代码行数:10,代码来源:ST_Turret.cs

示例9: Awake

    // Use this for initialization
    void Awake()
    {
        briefingVO = gameObject.GetComponent<AudioSource>();

        briefingVO.PlayDelayed(1.5f);
    }
开发者ID:njunius,项目名称:Inure,代码行数:7,代码来源:BriefingVoiceOverDelay.cs

示例10: LoadAudioClipAndPlayDelayed

		AudioSource LoadAudioClipAndPlayDelayed( AudioSource source , string audioPath , float vol , float xchbgmTime , bool loop ){
			AudioClip clip = Resources.Load( audioPath ) as AudioClip;
			source.clip = clip;
			source.volume = vol;
			source.loop = loop;			
			source.PlayDelayed ( xchbgmTime );			
			return source;
		}
开发者ID:Joon-min,项目名称:wiper,代码行数:8,代码来源:SimpleSoundPlayer.cs

示例11: Start

 // Use this for initialization
 void Start()
 {
     entryDoorAudioSource = GetComponent<AudioSource> ();
     entryDoorAudioSource.PlayDelayed (2f);
 }
开发者ID:Kilmainham,项目名称:Kilmainham,代码行数:6,代码来源:entryDoorAudio.cs

示例12: PlayClip

	private void PlayClip(AudioSource a_source, AudioClip clip, float delay, float start_time, float volume, float pitch)
	{
		a_source.clip = clip;
		a_source.time = start_time;
		a_source.volume = volume;
		a_source.pitch = pitch;

#if !UNITY_3_5 && !UNITY_4_0
		a_source.PlayDelayed(delay);
#else
		a_source.Play((ulong)( delay * 44100));
#endif
	}
开发者ID:jporter19,项目名称:TeamStyle16_3D,代码行数:13,代码来源:EffectManager.cs

示例13: play

 private IEnumerator play(AudioSource audioSource, float delay = 0f)
 {
     audioSource.PlayDelayed(delay);
     yield return new WaitForSeconds (audioSource.clip.length);
     Destroy (audioSource);
 }
开发者ID:C453,项目名称:Valdemar,代码行数:6,代码来源:AudioManager.cs

示例14: Start

	void Start()
	{
		src = GetComponent<AudioSource>();
		src.clip = c0;
		src.PlayDelayed(2);
		dni = true;
		b0 = true;
	}
开发者ID:ChrisBeGames,项目名称:LightChaser_GGJ16,代码行数:8,代码来源:PixAudio.cs

示例15: Start

		// Use this for initialization
		void Start () {
			audioSource = GetComponent<AudioSource>();
			audioSource.clip = mooSounds[ Random.Range(0,mooSounds.Length-1)];

			audioSource.PlayDelayed(mooDelay);
		}
开发者ID:Kundara,项目名称:project1,代码行数:7,代码来源:CowSounds.cs


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