Exemple #1
0
 /// <summary>
 /// Sound Settings stuff,
 /// Play the flying sound and loop the sound.
 /// </summary>
 private void PlayFlySound()
 {
     // play fly sound,
     // fly sound should be looped.
     if (mSoundPlayer != null)
     {
         mSoundPlayer.GetAudioSource().loop = true;
         mSoundPlayer.GetAudioSource().clip = mFlySound;
         mSoundPlayer.GetAudioSource().Play();
     }
 }
        //========================================
        //      Unity's function
        //------------------------------
        private void Update()
        {
            if (mSoundPlayer.GetAudioSource().isPlaying)
            {
                return;
            }

            Destroy(this.gameObject);
        }
        protected virtual void Start()
        {
            JCS_SoundManager sm = JCS_SoundManager.instance;

            sm.SetAudioListener(GetAudioListener());

            // add it to Sound Manager so it could manage
            // the volume and mute!
            sm.AssignSoundSource(JCS_SoundSettingType.SKILLS_SOUND, mSoundPlayer.GetAudioSource());
        }