private void LateUpdate()
        {
            if (!(m_type == ActorType.Character) || !current)
            {
                return;
            }

            switch (m_playType)
            {
            case PlayType.Footstep:
            {
                if (m_stepCycle < m_nextStep)
                {
                    break;
                }
                m_nextStep = m_stepCycle + m_stepInterval;
                SoundPreset.PlayOneshot(m_source, current.footstepSound);
                break;
            }

            case PlayType.Jump:
                SoundPreset.PlayOneshot(m_source, current.jumpSound);
                break;

            case PlayType.Land:
                SoundPreset.PlayOneshot(m_source, current.landSound);
                break;

            default:
                break;
            }
            m_playType = PlayType.Footstep;
        }
 private void OnCollisionEnter(Collision collision)
 {
     if (m_rd3 && m_type != ActorType.RigidBody || !material)
     {
         return;
     }
     if ((collision.relativeVelocity.sqrMagnitude > m_minSpeed * m_minSpeed) && m_source)
     {
         SoundPreset.PlayOneshot(m_source, material.hitSound);
     }
 }
Esempio n. 3
0
 // Update is called once per frame
 public void Play()
 {
     SoundPreset.PlayOneshot(audioSource, preset);
 }