3 protected float m_Shock;
4 protected float m_ShockValueMax;
5 protected float m_ShockValueThreshold;
8 protected const float UPDATE_THRESHOLD = 3;
9 const float VALUE_CHECK_INTERVAL = 0.95;
10 protected float m_CumulatedShock;
12 private float m_ShockMultiplier = 1;
13 private float m_PrevVignette;
14 private float m_LerpRes;
16 private const int LIGHT_SHOCK_HIT = 33;
17 private const int MID_SHOCK_HIT = 67;
18 private const int HEAVY_SHOCK_HIT = 100;
19 private const int INTENSITY_FACTOR = 1;
22 private const float PULSE_PERIOD = 0.5;
23 private const float PULSE_AMPLITUDE = 0.05;
24 private float m_PulseTimer;
26 protected ref Param1<float> m_Param;
32 m_PrevVignette =
m_Player.m_CurrentShock * 0.01;
33 m_ShockValueMax =
m_Player.GetMaxHealth(
"",
"Shock");
34 m_ShockValueThreshold = m_ShockValueMax * 0.95;
38 void Update(
float deltaT)
42 m_PulseTimer += deltaT;
49 PPERequesterBank.GetRequester(PPERequester_TunnelVisionEffects).Stop();
54 if (
m_Player.m_CurrentShock >= m_ShockValueThreshold)
56 PPERequesterBank.GetRequester(PPERequester_TunnelVisionEffects).Stop();
62 if (
m_Player.m_CurrentShock > m_ShockValueMax * 0.8)
63 val = MiscGameplayFunctions.Bobbing( PULSE_PERIOD, PULSE_AMPLITUDE, m_PulseTimer );
66 if (
m_Player.m_CurrentShock != (m_PrevVignette * 100) )
71 val_adjusted = 1 -
Easing.EaseInQuart(m_LerpRes) + val;
75 val_adjusted = 1 -
Easing.EaseInQuart( NormalizeShockVal(
m_Player.m_CurrentShock)) + val;
79 PPERequesterBank.GetRequester(PPERequester_TunnelVisionEffects).Start(
m_Param);
87 ShockHitEffect( m_PrevVignette * 100 );
88 m_PrevVignette =
m_Player.m_CurrentShock * 0.01;
96 float GetCurrentShock()
106 void SetShock(
float dealtShock )
108 m_Shock += dealtShock;
113 private void DealShock()
116 m_Player.GiveShock( -m_CumulatedShock );
120 void CheckValue(
bool forceUpdate)
122 m_CumulatedShock += m_Shock;
125 m_PrevVignette = NormalizeShockVal(
m_Player.m_CurrentShock );
135 if ( m_CumulatedShock >= UPDATE_THRESHOLD || forceUpdate )
137 m_CumulatedShock *= m_ShockMultiplier;
139 m_CumulatedShock = 0;
147 protected void Synchronize()
152 float SetMultiplier(
float mult)
154 m_ShockMultiplier = mult;
155 return m_ShockMultiplier;
158 private float NormalizeShockVal(
float shock )
160 float base =
m_Player.GetMaxHealth(
"",
"Shock") * INTENSITY_FACTOR;
161 float normShock = shock / base;
165 private float LerpVignette(
float x,
float y,
float deltaT )
168 output =
Math.Lerp(
x,
y, deltaT );
173 private void ShockHitEffect(
float compareBase )
175 float shockDifference = compareBase -
m_Player.m_CurrentShock;
177 if ( shockDifference >= UPDATE_THRESHOLD )
179 if ( m_CumulatedShock < 25 )
180 m_Player.SpawnShockEffect( MiscGameplayFunctions.Normalize( LIGHT_SHOCK_HIT, 100 ) );
181 else if ( m_CumulatedShock < 50 )
182 m_Player.SpawnShockEffect( MiscGameplayFunctions.Normalize( MID_SHOCK_HIT, 100 ) );
184 m_Player.SpawnShockEffect( MiscGameplayFunctions.Normalize( HEAVY_SHOCK_HIT, 100 ) );