Exemplo n.º 1
0
 void Attack(Damageable _damageable)
 {
     m_audioSourceControl.m_audioSource.Stop();
     m_audioSourceControl.m_audioSource.clip = m_attackSounds[Random.Range(0, m_attackSounds.Count)];
     m_audioSourceControl.SetLerpedVolume(m_attackVolume);
     m_audioSourceControl.m_audioSource.Play();
 }
Exemplo n.º 2
0
 void PlayGrowSound()
 {
     m_audioSourceControl.m_audioSource.Stop();
     m_audioSourceControl.m_audioSource.clip = m_growSounds[Random.Range(0, m_growSounds.Count)];
     m_audioSourceControl.SetLerpedVolume(m_growVolume);
     m_audioSourceControl.m_audioSource.Play();
 }
Exemplo n.º 3
0
    void SetState(State _state)
    {
        if (_state != m_state)
        {
            m_state = _state;
            switch (_state)
            {
            case State.NO_SOUND:
            {
                if (m_audioSourceControl.m_audioSource.isPlaying && m_audioSourceControl.m_audioSource.loop)
                {
                    m_audioSourceControl.m_audioSource.Stop();
                }
                break;
            }

            case State.HIT:
            {
                m_audioSourceControl.m_audioSource.Stop();
                m_audioSourceControl.m_audioSource.clip = m_hitSounds[Random.Range(0, m_hitSounds.Count)];
                m_audioSourceControl.m_audioSource.loop = false;
                m_audioSourceControl.SetLerpedVolume(m_hitVolume);
                m_audioSourceControl.m_audioSource.Play();

                break;
            }

            case State.CHOPPING:
            {
                m_audioSourceControl.m_audioSource.Stop();
                m_audioSourceControl.m_audioSource.clip = m_choppingSound;
                m_audioSourceControl.m_audioSource.loop = true;
                m_audioSourceControl.SetLerpedVolume(m_choppingVolume);
                m_audioSourceControl.m_audioSource.Play();
                break;
            }

            case State.THROWING:
            {
                m_audioSourceControl.m_audioSource.Stop();
                m_audioSourceControl.m_audioSource.clip = m_throwSounds[Random.Range(0, m_hitSounds.Count)];
                m_audioSourceControl.m_audioSource.loop = false;
                m_audioSourceControl.SetLerpedVolume(m_throwVolume);
                m_audioSourceControl.m_audioSource.Play();

                break;
            }
            }
        }
    }
Exemplo n.º 4
0
    void Update()
    {
        float volume = m_campfire.GetVivacityPercentage();

        if (volume > m_volumeStartToDecreaseAt)
        {
            volume = 1;
        }
        else
        {
            volume = Mathf.Lerp(0, m_volumeStartToDecreaseAt, volume);
        }
        m_campfireSound.SetLerpedVolume(volume);
    }