PlayDelayed() приватный Метод

private PlayDelayed ( float delay ) : void
delay float
Результат void
 // 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);
 }
Пример #2
0
    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);
    }
Пример #3
0
 // 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);
 }
Пример #4
0
 // 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;
 }
 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);
 }
Пример #6
0
    // 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);
    }
Пример #7
0
 static public int PlayDelayed(IntPtr l)
 {
     try {
         UnityEngine.AudioSource self = (UnityEngine.AudioSource)checkSelf(l);
         System.Single           a1;
         checkType(l, 2, out a1);
         self.PlayDelayed(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static int PlayDelayed(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject <UnityEngine.AudioSource>(L, 1);
         float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         obj.PlayDelayed(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #9
0
	// Use this for initialization
	void Start () 
	{
		sfx = variety[Random.Range(0, variety.Length)];
		sfx.PlayDelayed(0.3f);
		Destroy(gameObject, 1.0f);
	}
Пример #10
0
	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
	}
Пример #11
0
	void Start()
	{
		src = GetComponent<AudioSource>();
		src.clip = c0;
		src.PlayDelayed(2);
		dni = true;
		b0 = true;
	}
Пример #12
0
	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();
		}
	}
Пример #13
0
    // Use this for initialization
    void Awake()
    {
        briefingVO = gameObject.GetComponent<AudioSource>();

        briefingVO.PlayDelayed(1.5f);
    }
Пример #14
0
		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;
		}
Пример #15
0
 private IEnumerator play(AudioSource audioSource, float delay = 0f)
 {
     audioSource.PlayDelayed(delay);
     yield return new WaitForSeconds (audioSource.clip.length);
     Destroy (audioSource);
 }
Пример #16
0
 // Use this for initialization
 void Start()
 {
     entryDoorAudioSource = GetComponent<AudioSource> ();
     entryDoorAudioSource.PlayDelayed (2f);
 }
Пример #17
0
		// Use this for initialization
		void Start () {
			audioSource = GetComponent<AudioSource>();
			audioSource.clip = mooSounds[ Random.Range(0,mooSounds.Length-1)];

			audioSource.PlayDelayed(mooDelay);
		}