Exemple #1
0
 public static void PlayerAudio(SoundInfo.SoundTypes type)
 {
     switch (type)
     {
     case SoundInfo.SoundTypes.PLAYER_MOVEMENT:
         int playerMovementCount = SoundController.instance.playerMovement.Count;
         if (playerMovementCount > 0)
         {
             int randomMove = Random.Range(0, playerMovementCount);
             AudioSource.PlayClipAtPoint(SoundController.instance.playerMovement[randomMove], Vector3.zero, 0.5f);
         }
         break;
     }
 }
Exemple #2
0
        public static AudioClip GetAudioType(SoundInfo.SoundTypes type)
        {
            int count = 0;

            switch (type)
            {
            case SoundInfo.SoundTypes.BLOCK_MOVEMENT:
                count = SoundController.instance.blockMovement.Count;
                if (count > 0)
                {
                    int random = Random.Range(0, count);
                    return(SoundController.instance.blockMovement[random]);
                }
                break;

            case SoundInfo.SoundTypes.PLAYER_MOVEMENT:
                count = SoundController.instance.playerMovement.Count;
                if (count > 0)
                {
                    int random = Random.Range(0, count);
                    return(SoundController.instance.playerMovement[random]);
                }
                break;

            case SoundInfo.SoundTypes.PLAYER_COLLISION:
                count = SoundController.instance.playerCollision.Count;
                if (count > 0)
                {
                    int random = Random.Range(0, count);
                    return(SoundController.instance.playerCollision[random]);
                }
                break;

            case SoundInfo.SoundTypes.PLAYER_STUNNED:
                count = SoundController.instance.playerStunned.Count;
                if (count > 0)
                {
                    int random = Random.Range(0, count);
                    return(SoundController.instance.playerStunned[random]);
                }
                break;

            case SoundInfo.SoundTypes.FIREWORK_EMIT:
                count = SoundController.instance.fireworkEmit.Count;
                if (count > 0)
                {
                    int random = Random.Range(0, count);
                    return(SoundController.instance.fireworkEmit[random]);
                }
                break;

            case SoundInfo.SoundTypes.FIREWORK_EXPLOSION:
                count = SoundController.instance.fireworkExplosion.Count;
                if (count > 0)
                {
                    int random = Random.Range(0, count);
                    return(SoundController.instance.fireworkExplosion[random]);
                }
                break;
            }
            return(null);
        }