public static void Stop(Camera camera, float time = 0f) { if (camera != null) { CameraShakeMgr component = camera.GetComponent <CameraShakeMgr>(); if (component != null) { if (time <= 0f) { component.DestroyShake(); } else { float valueStart = component.ComputeIntensity(); AnimationCurve intensityCurve = AnimationCurve.Linear(0f, valueStart, time, 0f); component.StartShake(component.m_amount, intensityCurve, null); } } } }
public static void Shake(Camera camera, Vector3 amount, AnimationCurve intensityCurve, float?holdAtTime = new float?()) { if (camera != null) { CameraShakeMgr component = camera.GetComponent <CameraShakeMgr>(); if (component != null) { if (DoesCurveHaveZeroTime(intensityCurve)) { component.DestroyShake(); return; } } else { if (DoesCurveHaveZeroTime(intensityCurve)) { return; } component = camera.gameObject.AddComponent <CameraShakeMgr>(); } component.StartShake(amount, intensityCurve, holdAtTime); } }