DayZ 1.24
Loading...
Searching...
No Matches
FlashbangEffect Class Reference
Collaboration diagram for FlashbangEffect:
[legend]

Protected Member Functions

void FlashbangEffect (PlayerBase player, bool visual=true)
 
void ~FlashbangEffect ()
 
void SetupFlashbangValues (float progress_mult=1.0, float visual_value_max=1.0, float sound_value_max=1.0)
 
void PlaySound ()
 
void SetAttenuationFilter ()
 
void ResetAttenuationFilter ()
 
void StopSound ()
 
void ClearVisual ()
 
void SetVisual (float val)
 
void Stop ()
 
void Update (float deltatime)
 

Protected Attributes

const float ALPHA_MIN = 0.0
 
const float ALPHA_MAX = 1.0
 
const float SOUND_DEFER_TIME = 0.4
 
float m_HitDuration
 SFX will be played ~0.5s AFTER VFX.
 
float m_BreakPoint
 
float m_TimeActive
 
float m_DayTimeToggle
 
float m_AlphaMaxActual
 
float m_SoundMaxActual
 
float m_ProgressMultiplier
 
bool m_Visual
 
bool m_Initialized
 
PlayerBase m_Player
 
EffectSound m_FlashbangEffectSound
 
float m_SoundStopTime
 
ref Timer m_DeferAttenuation
 
PPERequester_FlashbangEffects m_Requester
 

Detailed Description

Definition at line 1 of file FlashbangEffect.c.

Constructor & Destructor Documentation

◆ FlashbangEffect()

void FlashbangEffect::FlashbangEffect ( PlayerBase player,
bool visual = true )
inlineprotected

naive time of the day selector

-1: night; 1: day

Definition at line 28 of file FlashbangEffect.c.

29 {
32 m_Initialized = false;
33
34 m_HitDuration = 8.0;
35 m_BreakPoint = 2.5;
37 m_SoundMaxActual = 1.0;
39
41
42 if (m_Visual)
43 {
45 m_Requester.Start();
46 }
47
49 m_DeferAttenuation.Run(SOUND_DEFER_TIME, this, "PlaySound", null, false);
50
52 m_DayTimeToggle = 5;
53 if (g_Game.GetDayTime() >= 22.0 || g_Game.GetDayTime() < 7.0)
54 m_DayTimeToggle = 10;
55 }
DayZGame g_Game
Definition DayZGame.c:3528
Super root of all classes in Enforce script.
Definition EnScript.c:11
const float SOUND_DEFER_TIME
EffectSound m_FlashbangEffectSound
PlayerBase m_Player
float m_HitDuration
SFX will be played ~0.5s AFTER VFX.
PPERequester_FlashbangEffects m_Requester
const float ALPHA_MAX
ref Timer m_DeferAttenuation
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References ALPHA_MAX, Class::CastTo(), g_Game, m_AlphaMaxActual, m_BreakPoint, m_DayTimeToggle, m_DeferAttenuation, m_FlashbangEffectSound, m_HitDuration, m_Initialized, m_Player, m_ProgressMultiplier, m_Requester, m_SoundMaxActual, m_Visual, and SOUND_DEFER_TIME.

◆ ~FlashbangEffect()

void FlashbangEffect::~FlashbangEffect ( )
inlineprotected

Definition at line 57 of file FlashbangEffect.c.

58 {
59 if (m_Visual)
61
62 if (m_Player)
63 m_Player.OnPlayerReceiveFlashbangHitEnd();
64
65 if (m_DeferAttenuation.IsRunning())
66 m_DeferAttenuation.Stop();
67
70 }
Manager class for managing Effect (EffectParticle, EffectSound)
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.

References ClearVisual(), SEffectManager::DestroyEffect(), m_DeferAttenuation, m_FlashbangEffectSound, m_Player, and m_Visual.

Member Function Documentation

◆ ClearVisual()

void FlashbangEffect::ClearVisual ( )
inlineprotected

Definition at line 137 of file FlashbangEffect.c.

138 {
139 if (m_Requester)
140 m_Requester.Stop();
141 }

References m_Requester.

Referenced by ~FlashbangEffect().

◆ PlaySound()

void FlashbangEffect::PlaySound ( )
inlineprotected

Definition at line 86 of file FlashbangEffect.c.

87 {
88 if (!m_Initialized)
89 {
90 Error("" + this + " not initialized");
91 return;
92 }
93
94 vector pos;
95 MiscGameplayFunctions.GetHeadBonePos(m_Player, pos);
96
98 m_FlashbangEffectSound = SEffectManager.CreateSound("Tinnitus_SoundSet", pos);
99
101 {
103 m_FlashbangEffectSound.SetAttachedLocalPos(m_Player.WorldToModel(pos));
112
114 }
115 }
WaveKind
Definition Sound.c:2
override bool IsPlaying()
Returns true when the effect is playing, false otherwise.
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
override void SetParent(Object parent_obj)
Set parent for the sound to follow.
void SetSoundMaxVolume(float volume)
Set the sound max volume.
void SetSoundLoop(bool loop)
Set if the sound loops.
void SetSoundFadeIn(float fade_in)
Set the sound fade in duration.
void SetSoundWaveKind(WaveKind wave_kind)
Set WaveKind for the sound.
void SetSoundFadeOut(float fade_out)
Set the sound fade out duration.
bool SoundPlay()
Plays sound.
Definition EnMath.c:7
static EffectSound CreateSound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false, bool enviroment=false)
Create an EffectSound.
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.

References Math::Clamp(), SEffectManager::CreateSound(), Error(), EffectSound::IsPlaying(), m_FlashbangEffectSound, m_Initialized, m_Player, m_ProgressMultiplier, m_SoundMaxActual, m_SoundStopTime, SetAttenuationFilter(), EffectSound::SetAutodestroy(), EffectSound::SetParent(), EffectSound::SetSoundFadeIn(), EffectSound::SetSoundFadeOut(), EffectSound::SetSoundLoop(), EffectSound::SetSoundMaxVolume(), EffectSound::SetSoundWaveKind(), and EffectSound::SoundPlay().

◆ ResetAttenuationFilter()

void FlashbangEffect::ResetAttenuationFilter ( )
inlineprotected

Definition at line 123 of file FlashbangEffect.c.

124 {
125 m_Player.SetMasterAttenuation("");
126 }

References m_Player.

Referenced by Update().

◆ SetAttenuationFilter()

void FlashbangEffect::SetAttenuationFilter ( )
inlineprotected

Definition at line 117 of file FlashbangEffect.c.

118 {
119 if (!m_DeferAttenuation.IsRunning() || m_Player.GetMasterAttenuation() != "FlashbangAttenuation")
120 m_Player.SetMasterAttenuation("FlashbangAttenuation");
121 }

References m_DeferAttenuation, and m_Player.

Referenced by PlaySound().

◆ SetupFlashbangValues()

void FlashbangEffect::SetupFlashbangValues ( float progress_mult = 1.0,
float visual_value_max = 1.0,
float sound_value_max = 1.0 )
inlineprotected

◆ SetVisual()

void FlashbangEffect::SetVisual ( float val)
inlineprotected

Definition at line 143 of file FlashbangEffect.c.

144 {
145 if (m_Requester && m_Requester.IsRequesterRunning())
146 m_Requester.SetFlashbangIntensity(val, m_DayTimeToggle);
147 }

References m_DayTimeToggle, and m_Requester.

Referenced by Update().

◆ Stop()

void FlashbangEffect::Stop ( )
inlineprotected

Definition at line 149 of file FlashbangEffect.c.

150 {
151 StopSound();
152 }

References StopSound().

◆ StopSound()

void FlashbangEffect::StopSound ( )
inlineprotected

◆ Update()

void FlashbangEffect::Update ( float deltatime)
inlineprotected

Definition at line 154 of file FlashbangEffect.c.

155 {
156 if (!m_Initialized)
157 Error("" + this + " not initialized");
158 else if (m_Visual)
159 {
160 float value;
161
163 {
165 //Print("Flashbango | m_AlphaMaxActual: " + value);
166 }
167 else
168 {
170 value = Math.Clamp(value, 0.0, 1.0);
172 //Print("Flashbango | tmp_value: " + value);
173 }
175 }
176
178
180 StopSound();
181
183 {
185 delete this;
186 }
187 }
void ResetAttenuationFilter()
void SetVisual(float val)
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...

References Math::Clamp(), Error(), Math::InverseLerp(), m_AlphaMaxActual, m_BreakPoint, m_HitDuration, m_Initialized, m_SoundStopTime, m_TimeActive, m_Visual, ResetAttenuationFilter(), SetVisual(), and StopSound().

Member Data Documentation

◆ ALPHA_MAX

const float FlashbangEffect::ALPHA_MAX = 1.0
protected

Definition at line 4 of file FlashbangEffect.c.

Referenced by FlashbangEffect().

◆ ALPHA_MIN

const float FlashbangEffect::ALPHA_MIN = 0.0
protected

Definition at line 3 of file FlashbangEffect.c.

◆ m_AlphaMaxActual

float FlashbangEffect::m_AlphaMaxActual
protected

Definition at line 13 of file FlashbangEffect.c.

Referenced by FlashbangEffect(), SetupFlashbangValues(), and Update().

◆ m_BreakPoint

float FlashbangEffect::m_BreakPoint
protected

Definition at line 9 of file FlashbangEffect.c.

Referenced by FlashbangEffect(), SetupFlashbangValues(), and Update().

◆ m_DayTimeToggle

float FlashbangEffect::m_DayTimeToggle
protected

Definition at line 11 of file FlashbangEffect.c.

Referenced by FlashbangEffect(), and SetVisual().

◆ m_DeferAttenuation

ref Timer FlashbangEffect::m_DeferAttenuation
protected

Definition at line 24 of file FlashbangEffect.c.

Referenced by FlashbangEffect(), SetAttenuationFilter(), and ~FlashbangEffect().

◆ m_FlashbangEffectSound

EffectSound FlashbangEffect::m_FlashbangEffectSound
protected

Definition at line 21 of file FlashbangEffect.c.

Referenced by FlashbangEffect(), PlaySound(), StopSound(), and ~FlashbangEffect().

◆ m_HitDuration

float FlashbangEffect::m_HitDuration
protected

SFX will be played ~0.5s AFTER VFX.

Definition at line 8 of file FlashbangEffect.c.

Referenced by FlashbangEffect(), SetupFlashbangValues(), and Update().

◆ m_Initialized

bool FlashbangEffect::m_Initialized
protected

Definition at line 18 of file FlashbangEffect.c.

Referenced by FlashbangEffect(), PlaySound(), SetupFlashbangValues(), and Update().

◆ m_Player

PlayerBase FlashbangEffect::m_Player
protected

◆ m_ProgressMultiplier

float FlashbangEffect::m_ProgressMultiplier
protected

Definition at line 15 of file FlashbangEffect.c.

Referenced by FlashbangEffect(), PlaySound(), and SetupFlashbangValues().

◆ m_Requester

PPERequester_FlashbangEffects FlashbangEffect::m_Requester
protected

Definition at line 26 of file FlashbangEffect.c.

Referenced by ClearVisual(), FlashbangEffect(), and SetVisual().

◆ m_SoundMaxActual

float FlashbangEffect::m_SoundMaxActual
protected

Definition at line 14 of file FlashbangEffect.c.

Referenced by FlashbangEffect(), PlaySound(), and SetupFlashbangValues().

◆ m_SoundStopTime

float FlashbangEffect::m_SoundStopTime
protected

Definition at line 22 of file FlashbangEffect.c.

Referenced by PlaySound(), and Update().

◆ m_TimeActive

float FlashbangEffect::m_TimeActive
protected

Definition at line 10 of file FlashbangEffect.c.

Referenced by Update().

◆ m_Visual

bool FlashbangEffect::m_Visual
protected

Definition at line 17 of file FlashbangEffect.c.

Referenced by FlashbangEffect(), Update(), and ~FlashbangEffect().

◆ SOUND_DEFER_TIME

const float FlashbangEffect::SOUND_DEFER_TIME = 0.4
protected

Definition at line 6 of file FlashbangEffect.c.

Referenced by FlashbangEffect().


The documentation for this class was generated from the following file: