21 private static SCR_CameraShakeManagerComponent s_Instance;
30 static void AddCameraShake(
float linearMagnitude = 1.0,
float angularMagnitude = 1.0,
float inTime = 0.01,
float sustainTime = 0.1,
float outTime = 0.24)
33 s_Instance.DoAddCameraShake(linearMagnitude, angularMagnitude, inTime, sustainTime, outTime);
43 void DoAddCameraShake(
float linearMagnitude = 1.0,
float angularMagnitude = 1.0,
float inTime = 0.01,
float sustainTime = 0.1,
float outTime = 0.24)
49 if (shake.IsFinished())
51 shake.SetParams(linearMagnitude, angularMagnitude, inTime, sustainTime, outTime);
64 s_Instance.DoAddCameraShake(instance);
74 Print(
"Invalid camera shake instance passed to manager!", LogLevel.ERROR);
84 static void ApplyCameraShake(inout vector matrix[4], inout
float fov)
87 s_Instance.DoApplyCameraShake(matrix, fov);
97 if (DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_CHARACTER_ADDITIONAL_CAMERASHAKE_DISABLE))
107 static void ClearCameraShake()
110 s_Instance.DoClearCameraShake();
120 if (!shake.IsFinished())
134 if (System.IsConsoleApp())
138 SetEventMask(owner, EntityEvent.FRAME);
149 override void EOnFrame(IEntity owner,
float timeSlice)
159 if (!shake.IsFinished())
161 shake.Update(owner, timeSlice);
170 if (!shake || shake.IsFinished())
178 shake.Update(owner, timeSlice);
182 super.EOnFrame(owner, timeSlice);
186 if (DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_CHARACTER_CAMERASHAKE_TEST_WINDOW))
188 DbgUI.Begin(
"Camera Shake");
190 float linear = 1, angular = 1, inTime = 0.01, sustainTime = 0.1, outTime = 1.0;
191 DbgUI.Text(
"New shake: ");
192 DbgUI.InputFloat(
"Linear: ", linear);
193 DbgUI.InputFloat(
"Angular: ", angular);
194 DbgUI.InputFloat(
"InTime: ", inTime);
195 DbgUI.InputFloat(
"SustainTime: ", sustainTime);
196 DbgUI.InputFloat(
"OutTime: ", outTime);
198 if (DbgUI.Button(
"Add new shake"))
200 AddCameraShake(linear, angular, inTime, sustainTime, outTime);
203 if (DbgUI.Button(
"Add custom shake"))
207 progress.SetParams(linear, angular, inTime, sustainTime, outTime);
209 AddCameraShake(progress);
214 if (DbgUI.Button(
"Clear shake"))