Exemplo n.º 1
0
 public void PlayDeathSound(DeathSounds DeathSound)
 {
     if (DeathSound == DeathSounds.Male)
     {
         ArrayDeathMaleSound[Random.Next(0, ArrayDeathMaleSound.Length)].Play();
     }
     else if (DeathSound == DeathSounds.Female)
     {
         ArrayDeathFemaleSound[Random.Next(0, ArrayDeathFemaleSound.Length)].Play();
     }
 }
        public SoundEffectSystem(EnemyAttackSounds enemyAttackSounds, PlayerAttackSounds playerAttackSounds,
                                 WalkingSounds walkingSounds, DeathSounds deathSounds, DrinkSounds drinkSounds,
                                 FoodSounds foodSounds, IEventSystem eventSystem)
        {
            _enemyAttackSounds  = enemyAttackSounds;
            _playerAttackSounds = playerAttackSounds;
            _walkingSounds      = walkingSounds;
            _deathSounds        = deathSounds;
            _drinkSounds        = drinkSounds;
            _foodSounds         = foodSounds;

            _eventSystem = eventSystem;

            var soundEffectObject = GameObject.Find("SoundEffectSource");

            _soundEffectSource = soundEffectObject.GetComponent <AudioSource>();
        }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        spriteTransform = transform.Find("Sprite");
        bloodTransform  = transform.Find("blood");
        if (bloodTransform)
        {
            bloodTransform.gameObject.SetActive(false);
        }

        audioSourceObject = GameObject.Find("Audio_DeathSounds");
        audioSource       = audioSourceObject.GetComponent <AudioSource>();
        am = audioSourceObject.GetComponent <DeathSounds>();

        if (!audioSource.isPlaying)
        {
            int rndIndex = Random.Range(0, am.deathSounds.Length - 1);
            audioSource.clip = am.deathSounds[rndIndex];
            audioSource.Play();
        }
    }
 public void PlayDeathSound(DeathSounds DeathSound)
 {
 }