當前位置: 首頁>>代碼示例>>C#>>正文


C# AudioSource.Pause方法代碼示例

本文整理匯總了C#中UnityEngine.AudioSource.Pause方法的典型用法代碼示例。如果您正苦於以下問題:C# AudioSource.Pause方法的具體用法?C# AudioSource.Pause怎麽用?C# AudioSource.Pause使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnityEngine.AudioSource的用法示例。


在下文中一共展示了AudioSource.Pause方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Start

	// Use this for initialization
	void Start () {
	
		InvokeRepeating("CreateMyInstance", 1.0f, 1.0f);

		// Checks the value of muteSound that is set on Home Screen page via the mute sound button.
		muteSoundValueCheck = PlayerPrefs.GetString("SoundValue") ;	
		
		// Debug.Log(muteSoundValueCheck);
		
		// Fetches engine sound attached to Main Camera object
		soundObject = GameObject.Find("Camera");
		audioSource = soundObject.GetComponent<AudioSource>();
		
		// Fetches Car Dash sound attached to 'car-control-cube' object 
		soundObject2 = GameObject.Find("car-control-cube");
		audioSource2 = soundObject.GetComponent<AudioSource>();
		
		if (muteSoundValueCheck == "mute") {
			
			audioSource.Pause();
			audioSource2.Pause();
			
		}


	}
開發者ID:Asutosh11,項目名稱:CountryDriver,代碼行數:27,代碼來源:OppositeCars.cs

示例2: Start

    void Start()
    {
        audio = GetComponent<AudioSource>();
		ParentAudio = transform.parent.gameObject.GetComponent<AudioSource>();
        if (audio.isPlaying)
                audio.Pause();
    }
開發者ID:jerrybeanman,項目名稱:GGJ2016-Freya-s-Temptations,代碼行數:7,代碼來源:Killable.cs

示例3: Start

 public override void Start()
 {
     base.Start();
     _audio = this.GetComponent<AudioSource>();
     _baseVolume = _audio.volume;
     _audio.Pause();
 }
開發者ID:DrSkipper,項目名稱:ForAshley,代碼行數:7,代碼來源:MusicDurationHandler.cs

示例4: Start

 void Start()
 {
     Player = GameObject.FindGameObjectWithTag ("Player");
     GetComponent<MeshRenderer>().enabled = false;
     Scare = false;
     audiosource = this.GetComponent<AudioSource>();
     audiosource.Pause ();
 }
開發者ID:tbhosman,項目名稱:Reaktor,代碼行數:8,代碼來源:JumpScareScript.cs

示例5: PauseMusic

    IEnumerator PauseMusic(AudioSource toPause, AudioMixerSnapshot current, float time)
    {
        yield return new WaitForSeconds(time);

        if (this.current == current)
        {
            toPause.Pause();
        }
    }
開發者ID:MarjieVolk,項目名稱:ShopTilYouDrop,代碼行數:9,代碼來源:AudioSwitcher.cs

示例6: Start

 void Start()
 {
     float distance = father.transform.localScale.x;
     float radian = Mathf.Min (distance, father.transform.localScale.z);
     transform.localScale = new Vector3 (2.0f - radian / distance, transform.localScale.y, 1.0f);
     OnUpdateVariable ();
     frictionSound = father.GetComponent<AudioSource> ();
     frictionSound.Pause ();
 }
開發者ID:charlieusc,項目名稱:Perplexus,代碼行數:9,代碼來源:BeltController.cs

示例7: Start

	void Start ()
	{
		Transform father = transform.parent;
		distance = father.localScale.x;
		float radian = Mathf.Min (distance, father.localScale.z);
		transform.localScale = new Vector3 (2f - radian / distance, transform.localScale.y, 1f);
		frictionSound = father.gameObject.GetComponent<AudioSource> ();
		frictionSound.Pause ();
		beltRenders = GetComponentsInChildren<Renderer> ();
	}
開發者ID:Changtx,項目名稱:Perplexes,代碼行數:10,代碼來源:BeltController.cs

示例8: FadeOut

 private void FadeOut(AudioSource audioSource)
 {
     if(audioSource.volume > 0f) {
         audioSource.volume -= .05f;
         //print ("offing" + audioSource.clip.name);
     }
     if (audioSource.volume == 0f) {
         audioSource.Pause ();
     }
 }
開發者ID:fdu5526,項目名稱:balloon,代碼行數:10,代碼來源:FlowerPlayerAudio.cs

示例9: Start

    void Start()
    {
        audio = GetComponent<AudioSource>();
        if(audio == null)
        {
            Debug.Log("Hello World");
        }
        audio.Pause();

        ammoCount = 15;
    }
開發者ID:sweeseng789,項目名稱:Interface,代碼行數:11,代碼來源:Weapon.cs

示例10: Start

 void Start()
 {
     music = GetComponent<AudioSource>();
     if (PlayerPrefs.HasKey ("Music")) {
         int audio = PlayerPrefs.GetInt("Music");
         if(audio == 0){
             musicOn = false;
             music.Pause();
         }
     }
 }
開發者ID:pavelstefan,項目名稱:Kenney-s-Adventures,代碼行數:11,代碼來源:Music.cs

示例11: Start

 //public AudioClip Clip;// = null;
 // Use this for initialization
 void Start()
 {
     //initiate audio source
     _audioSource = GetComponent<AudioSource>();
     float r = Random.Range(-PitchVariation, PitchVariation);
     _audioSource.pitch += r;
     //_audioSource.clip = Clip;
     //set random start
     _random = Random.Range(LowerRange/Frequency, Upperrange/Frequency);
     _random += PitchOffset;
     _audioSource.Pause();
     _clipLength = _audioSource.clip.length;
 }
開發者ID:ThomasVanRiel,項目名稱:NotFish,代碼行數:15,代碼來源:SoundManager.cs

示例12: Start

    // Use this for initialization
    void Start()
    {
        // audioPause = GetComponent<AudioSource>();
           // audioPause.Pause();

          //  audioLevelOne = GetComponent<AudioSource>();
          //  audioLevelOne.Play();
        AudioSource[] audios = GetComponents<AudioSource>();
        audioPause = audios[1];
        audioLevelOne = audios[0];

        audioPause.Pause();
    }
開發者ID:Pucek9,項目名稱:ProjectUnity,代碼行數:14,代碼來源:PauseManager.cs

示例13: Start

	// Use this for initialization
	void Start () {
        music_isplaying = PlayerPrefs.GetInt(Common_data.music_pref, 1);
        sound_isplaying = PlayerPrefs.GetInt(Common_data.sound_pref, 1);

        audio = this.gameObject.GetComponent<AudioSource>();
        if (music_isplaying == 1)
        {

            audio.Play();
        }
        else {
            audio.Pause();
        }

	}
開發者ID:tangjie466,項目名稱:Crazy_panda_noyoumi,代碼行數:16,代碼來源:audio_controller.cs

示例14: Start

	// Use this for initialization
	void Start () {
	Time.timeScale = 1.0f;
        manager.loadAchievements();
		isPaused = false;
		isOpen = false;

		PlayerProfile.profile.load ();

		pauseSource = GetComponent<AudioSource> ();
		pauseSource.ignoreListenerPause = true;
		pauseSource.Play ();
		pauseSource.Pause ();
		PanelControls.SetActive(false);

		MovementTip.SetActive(false);
		BasicCameraTip.SetActive(false);
		SeeControlsTip.SetActive(false);
		setPause (false);
		tutTimer = PlayerProfile.profile.timeElapsedInPark;

	}
開發者ID:SamReha,項目名稱:SnapshotGame,代碼行數:22,代碼來源:UIManager.cs

示例15: PauseSound

 public void PauseSound(AudioSource sound)
 {
     sound.Pause();
 }
開發者ID:FlorinVasileNechita,項目名稱:PlantsVsZombies_unity,代碼行數:4,代碼來源:AudioManager.cs


注:本文中的UnityEngine.AudioSource.Pause方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。