3 const float IN_AREA_CONSUME_FILTER_QUANTITY_PER_SEC = 0.3;
4 const float OUT_AREA_CONSUME_FILTER_QUANTITY_PER_SEC = 0.03;
6 const float STAMINA_RECOVERY_MODIFIER = 0.5;
7 const float STAMINA_DEPLETION_MODIFIER = 1.25;
9 const float LOW_FILTER_SOUND_EVENT_MIN = 3;
10 const float LOW_FILTER_SOUND_EVENT_MAX = 9;
12 const float LOW_FILTER_SOUND_THRESHOLD = 0.2;
14 float m_SoundTimeAccu1;
15 float m_NextSoundEventTime;
25 override bool ActivateCondition(
PlayerBase player)
30 override bool DeactivateCondition(
PlayerBase player)
32 return !ActivateCondition( player);
35 override void OnTick(
PlayerBase player,
float deltaT)
39 float consume_quantity = OUT_AREA_CONSUME_FILTER_QUANTITY_PER_SEC;
45 consume_quantity = IN_AREA_CONSUME_FILTER_QUANTITY_PER_SEC;
48 if ( mask && !mask.IsDamageDestroyed())
50 bool consuming_filter = mask.ConsumeQuantity(consume_quantity * deltaT, player);
51 StaminaSoundHandlerServer.Cast(player.GetPlayerSoundManagerServer().GetHandler(
eSoundHandlers.STAMINA)).SetStaminaZoneOffset(1);
53 if (mask.HasValidFilter())
64 HandleSounds(player, deltaT, mask);
70 float filter_quantity_01 = mask.GetFilterQuantity01();
72 if(mask.CanHaveExternalFilter() && !mask.IsExternalFilterAttached())
75 if(filter_quantity_01 > LOW_FILTER_SOUND_THRESHOLD)
78 float low_quantity_norm =
Math.InverseLerp(0, LOW_FILTER_SOUND_THRESHOLD, filter_quantity_01);
80 m_SoundTimeAccu1 += deltaT;
81 if( m_SoundTimeAccu1 >= m_NextSoundEventTime)
83 m_NextSoundEventTime =
Math.Lerp(LOW_FILTER_SOUND_EVENT_MIN, LOW_FILTER_SOUND_EVENT_MAX,low_quantity_norm);
87 if (low_quantity_norm < 0.5)
91 if (low_quantity_norm < 0.25)
95 player.RequestSoundEventEx(event_type,
false, EPlayerSoundEventParam.HIGHEST_PRIORITY);
112 StaminaSoundHandlerServer.Cast(player.GetPlayerSoundManagerServer().GetHandler(
eSoundHandlers.STAMINA)).SetStaminaZoneOffset(0);