public static void Play(string name)
    {
        ImpulseSource s = Array.Find(Instance.impulseSources, source => source.name == name);

        // If we found the sound, play it
        if (s == null)
        {
            Debug.LogWarning("ImpulseSource: " + name + " not found!");
        }
        else
        {
            s.cinemachineImpulseSource.GenerateImpulse();
        }
    }
Пример #2
0
        public void Shake(float duration, float intensity, float frequency, bool overrideCurrentShake = true)
        {
            if (IsShaking && !overrideCurrentShake)
            {
                Debug.LogWarning("Camera is already shaking");
                return;
            }

            IsShaking = true;
            ImpulseSource.m_ImpulseDefinition.m_AmplitudeGain             = intensity;
            ImpulseSource.m_ImpulseDefinition.m_FrequencyGain             = frequency;
            ImpulseSource.m_ImpulseDefinition.m_TimeEnvelope.m_AttackTime = duration / 2;
            ImpulseSource.m_ImpulseDefinition.m_TimeEnvelope.m_DecayTime  = duration / 2;
            ImpulseSource.GenerateImpulse();
        }