當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。