Пример #1
0
 public void PlaySFX(eSoundType type)
 {
     if (_soundDic.ContainsKey(type))
     {
         AudioClip clip = _soundDic[type];
         //_sfxSource.clip = clip;
         _sfxSource.PlayOneShot(clip, 0.4f);
     }
 }
Пример #2
0
 public Sound(GameStructure i_Game, string i_AssetName, bool i_IsLooped, eSoundType i_SoundType)
 {
     m_AssetName = i_AssetName;
     m_SoundEffectInstance = i_Game.Content.Load<SoundEffect>(i_AssetName).CreateInstance();
     m_SoundEffectInstance.IsLooped = i_IsLooped;
     m_SoundType = i_SoundType;
     SoundVolume = 0.5f;
     IsMuted = false;
 }
Пример #3
0
    public void StopSound(eSoundType soundType)
    {
        int soundIndex = (int)soundType;

        if (_soundTable.Count > soundIndex && _soundTable[soundIndex].isPlaying)
        {
            _soundTable[(int)soundType].Stop();
        }
    }
Пример #4
0
 public void PlaySound(eSoundType soundType)
 {
     if (_soundVolume <= 0)
     {
         return;
     }
     if (_soundTable.Count > (int)soundType && _soundTable[(int)soundType].clip)
     {
         _soundTable[(int)soundType].Play();
     }
 }
Пример #5
0
 public void DecreaseSoundsMusicVolume(eSoundType i_SoundType)
 {
     foreach (Sound sound in m_Sounds)
     {
         if (sound.SoundType == i_SoundType)
         {
             sound.SoundVolume = MathHelper.Clamp(sound.SoundVolume - 0.1f, 0, 1);
         }
     }
     VolumeDicionary[i_SoundType] = MathHelper.Clamp(VolumeDicionary[i_SoundType] + 0.1f, 0, 1);
 }
Пример #6
0
        public static Sound CreateSound(Game i_Game, eSoundType i_eSoundType)
        {
            SoundsManager m_soundManager = SpaceInvadersServices.GetSoundManager(i_Game);
            Sound         sound          = null;

            switch (i_eSoundType)
            {
            case eSoundType.BackgroundMusic:
                sound = new BackgroundSound(i_Game, k_BackgroundMusicAsset);
                break;

            case eSoundType.BarrierHit:
                sound = new SoundEffect(i_Game, k_BarrierHitAsset);
                break;

            case eSoundType.EnemyGunShot:
                sound = new SoundEffect(i_Game, k_EnemyGunShotAsset);
                break;

            case eSoundType.EnemyKill:
                sound = new SoundEffect(i_Game, k_EnemyKillAsset);
                break;

            case eSoundType.GameOver:
                sound = new SoundEffect(i_Game, k_GameOverAsset);
                break;

            case eSoundType.LevelWin:
                sound = new SoundEffect(i_Game, k_LevelWinAsset);
                break;

            case eSoundType.LifeDie:
                sound = new SoundEffect(i_Game, k_LifeDieAsset);
                break;

            case eSoundType.MenuMove:
                sound = new SoundEffect(i_Game, k_MenuMoveAsset);
                break;

            case eSoundType.MotherShipKill:
                sound = new SoundEffect(i_Game, k_MotherShipKillAsset);
                break;

            case eSoundType.SSGunShot:
                sound = new SoundEffect(i_Game, k_SSGunShotAsset);
                break;
            }

            m_soundManager.SetSoundByInstanceType(sound);
            m_soundManager.AddSound(sound);
            return(sound);
        }
Пример #7
0
    //-------------------------------------------------------------------
    public void PlayInternal(eSoundType type, Transform parent)
    {
        int idx = (int)type;
        List <AudioClip> clips = ClipBuckets[idx];

        if (clips.Count == 0)
        {
            return;
        }

        int audioIdx = Random.Range(0, clips.Count);

        PlayClipOn(clips[audioIdx], parent);
    }
Пример #8
0
        public static Sound CreateSound(Game i_Game, eSoundType i_eSoundType)
        {
            SoundsManager m_soundManager = SpaceInvadersServices.GetSoundManager(i_Game);
            Sound sound = null;
            switch (i_eSoundType)
            {
                case eSoundType.BackgroundMusic:
                    sound = new BackgroundSound(i_Game, k_BackgroundMusicAsset);
                    break;
                case eSoundType.BarrierHit:
                    sound = new SoundEffect(i_Game, k_BarrierHitAsset);
                    break;
                case eSoundType.EnemyGunShot:
                    sound = new SoundEffect(i_Game, k_EnemyGunShotAsset);
                    break;
                case eSoundType.EnemyKill:
                    sound = new SoundEffect(i_Game, k_EnemyKillAsset);
                    break;
                case eSoundType.GameOver:
                    sound = new SoundEffect(i_Game, k_GameOverAsset);
                    break;
                case eSoundType.LevelWin:
                    sound = new SoundEffect(i_Game, k_LevelWinAsset);
                    break;
                case eSoundType.LifeDie:
                    sound = new SoundEffect(i_Game, k_LifeDieAsset);
                    break;
                case eSoundType.MenuMove:
                    sound = new SoundEffect(i_Game, k_MenuMoveAsset);
                    break;
                case eSoundType.MotherShipKill:
                    sound = new SoundEffect(i_Game, k_MotherShipKillAsset);
                    break;
                case eSoundType.SSGunShot:
                    sound = new SoundEffect(i_Game, k_SSGunShotAsset);
                    break;
            }

            m_soundManager.SetSoundByInstanceType(sound);
            m_soundManager.AddSound(sound);
            return sound;
        }
Пример #9
0
 public static Sound CreateSound(GameScreen i_GameScreen, eSoundType i_SoundType)
 {
     return CreateSound(i_GameScreen.Game, i_SoundType);
 }
Пример #10
0
 public void SendPlaySound(eSoundType soundType, ushort soundID)
 {
 }
Пример #11
0
 public SoundData(eSoundType type, string assetName)
 {
     _type      = type;
     _assetName = assetName;
 }
Пример #12
0
 public SoundEx(eSoundType eType)
 {
 }
Пример #13
0
		public virtual void SendPlaySound(eSoundType soundType, ushort soundID)
		{
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.PlaySound)))
			{
				pak.WriteShort((ushort) soundType);
				pak.WriteShort(soundID);
				pak.Fill(0x00, 8);
				SendTCP(pak);
			}
		}
 public void RpcPlaySound(eSoundType type)
 {
     AudioManager.Play(type);
 }
 //----------------------------------------------------------------------
 public void PlaySoundOnPhone(eSoundType type)
 {
     RpcPlaySound(type);
 }
Пример #16
0
		public void SendPlaySound(eSoundType soundType, ushort soundID) { }
Пример #17
0
 public static Sound CreateSound(GameScreen i_GameScreen, eSoundType i_SoundType)
 {
     return(CreateSound(i_GameScreen.Game, i_SoundType));
 }
Пример #18
0
 //-------------------------------------------------------------------
 public static void PlayOn(eSoundType type, Transform parent)
 {
     GetInstance().PlayInternal(type, parent);
 }
Пример #19
0
 //-------------------------------------------------------------------
 public static void Play(eSoundType type)
 {
     GetInstance().PlayInternal(type, null);
 }
Пример #20
0
		public void SendPlaySound(eSoundType soundType, ushort soundID)
		{
			if (SendPlaySoundMethod != null) SendPlaySoundMethod(this, soundType, soundID);
		}