ACE3/addons/medical_feedback/functions/fnc_effectHeartBeat.sqf

43 lines
1.1 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
2017-01-29 19:24:16 +00:00
/*
* Author: BaerMitUmlaut
* Handles the hear beat sound.
*
* Arguments:
* None
2017-01-29 19:24:16 +00:00
*
* Return Value:
* None
2019-03-30 16:07:54 +00:00
*
* Example:
* [] call ace_medical_feedback_fnc_effectHeartBeat
2019-03-30 16:07:54 +00:00
*
* Public: No
2017-01-29 19:24:16 +00:00
*/
private _heartRate = GET_HEART_RATE(ACE_player);
2017-01-29 19:24:16 +00:00
2017-03-18 16:53:57 +00:00
if (_heartRate == 0) exitWith {
TRACE_1("Ending heart beat effect - zero",_heartRate);
GVAR(heartBeatEffectRunning) = false;
};
2017-01-29 20:20:55 +00:00
private _waitTime = 60 / _heartRate;
2017-01-29 19:24:16 +00:00
2017-03-18 16:53:57 +00:00
// TRACE_2("",_heartRate,_waitTime);
switch (true) do {
case (_heartRate > 160): {
2017-03-18 16:53:57 +00:00
// playSound SND_HEARBEAT_FAST; // Array doesn't blend together well, just play one file consistently
if (isGameFocused) then { playSound "ACE_heartbeat_fast_1"; };
[FUNC(effectHeartBeat), [], _waitTime] call CBA_fnc_waitAndExecute;
};
case (_heartRate < 60): {
if (isGameFocused) then { playSound SND_HEARBEAT_SLOW; };
[FUNC(effectHeartBeat), [], _waitTime] call CBA_fnc_waitAndExecute;
};
default {
2017-03-18 16:53:57 +00:00
TRACE_1("Ending heart beat effect - normal",_heartRate);
GVAR(heartBeatEffectRunning) = false;
2017-01-29 19:24:16 +00:00
};
};