UnityEngine.AudioSource.PlayOneShot C# (CSharp) Method

PlayOneShot() private method

private PlayOneShot ( AudioClip clip ) : void
clip AudioClip
return void
        public void PlayOneShot(AudioClip clip)
        {
            float volumeScale = 1f;
            this.PlayOneShot(clip, volumeScale);
        }

Same methods

AudioSource::PlayOneShot ( AudioClip clip, [ volumeScale ) : void

Usage Example

コード例 #1
0
    // Use this for initialization
    void Start()
    {
        transform.localScale = new Vector3(Camera.main.orthographicSize/2 * (Screen.width/Screen.height),Camera.main.orthographicSize/2,1f);

        audioSource = GetComponent<AudioSource> ();

        if (HammerController.gameOverState == 1) {
            //success
            GetComponent<MeshRenderer> ().materials [0].mainTexture = textures [0];
            movTerxture = (MovieTexture)GetComponent<MeshRenderer> ().materials [0].mainTexture;
            movTerxture.Play();
            audioSource.clip = music1;
            audioSource.Play();
            audioSource.PlayOneShot(voiceovers[0]);

        }
        else if(HammerController.gameOverState == 2 )
        {
            GetComponent<MeshRenderer> ().materials [0].mainTexture = textures [1];
            movTerxture = (MovieTexture)GetComponent<MeshRenderer> ().materials [0].mainTexture;
            movTerxture.Play();
            audioSource.clip = music2;
            audioSource.Play();
            audioSource.PlayOneShot(voiceovers[1]);

        }
    }
All Usage Examples Of UnityEngine.AudioSource::PlayOneShot