Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс ShockHandler

Защищенные члены

void ShockHandler (PlayerBase player)
 
void Update (float deltaT)
 
float GetCurrentShock ()
 
float GetShock ()
 
void SetShock (float dealtShock)
 
void Synchronize ()
 
float SetMultiplier (float mult)
 

Защищенные данные

float m_Shock
 
float m_ShockValueMax
 
float m_ShockValueThreshold
 
PlayerBase m_Player
 
const float UPDATE_THRESHOLD = 3
 
const float VALUE_CHECK_INTERVAL = 0.95
 
float m_CumulatedShock
 
ref Param1< floatm_Param
 

Закрытые члены

void DealShock ()
 
void CheckValue (bool forceUpdate)
 
float NormalizeShockVal (float shock)
 
float LerpVignette (float x, float y, float deltaT)
 
void ShockHitEffect (float compareBase)
 

Закрытые данные

float m_TimeSinceLastTick = VALUE_CHECK_INTERVAL + 1
 
float m_ShockMultiplier = 1
 
float m_PrevVignette
 
float m_LerpRes
 
const int LIGHT_SHOCK_HIT = 33
 
const int MID_SHOCK_HIT = 67
 
const int HEAVY_SHOCK_HIT = 100
 
const int INTENSITY_FACTOR = 1
 
const float PULSE_PERIOD = 0.5
 
const float PULSE_AMPLITUDE = 0.05
 
float m_PulseTimer
 

Подробное описание

Конструктор(ы)

◆ ShockHandler()

void ShockHandler ( PlayerBase player)
inlineprotected
29 {
31 m_Player.m_CurrentShock = m_Player.GetMaxHealth("", "Shock");
32 m_PrevVignette = m_Player.m_CurrentShock * 0.01; //Equivalent to divided by 100
33 m_ShockValueMax = m_Player.GetMaxHealth("", "Shock");
35 m_Param = new Param1<float>(0);
36 }
Definition EntityAI.c:95
PlayerBase m_Player
Definition ShockHandler.c:6
float m_ShockValueThreshold
Definition ShockHandler.c:5
float m_ShockValueMax
Definition ShockHandler.c:4
float m_PrevVignette
Definition ShockHandler.c:13
ref Param1< float > m_Param
Definition ShockHandler.c:26

Перекрестные ссылки m_Param, m_Player, m_PrevVignette, m_ShockValueMax и m_ShockValueThreshold.

Методы

◆ CheckValue()

void CheckValue ( bool forceUpdate)
inlineprivate
121 {
122 m_CumulatedShock += m_Shock; // increment on both client and server
123
124 if ( forceUpdate )
125 m_PrevVignette = NormalizeShockVal( m_Player.m_CurrentShock );
126
127 if ( GetGame().IsServer() )
128 {
129 m_Player.m_CurrentShock = m_Player.GetHealth("", "Shock");
130
131 /*
132 if (m_Player.m_CurrentShock <= 0)
133 m_Player.SetHealthMax("", "Shock");
134 */
136 {
138 DealShock();
140 m_Shock = 0;
141
142 Synchronize();
143 }
144 }
145 }
void DealShock()
Definition ShockHandler.c:113
const float UPDATE_THRESHOLD
Definition ShockHandler.c:8
float m_Shock
Definition ShockHandler.c:3
float m_ShockMultiplier
Definition ShockHandler.c:12
void Synchronize()
Definition ShockHandler.c:147
float NormalizeShockVal(float shock)
Definition ShockHandler.c:158
float m_CumulatedShock
Definition ShockHandler.c:10
proto native CGame GetGame()

Перекрестные ссылки DealShock(), GetGame(), m_CumulatedShock, m_Player, m_PrevVignette, m_Shock, m_ShockMultiplier, NormalizeShockVal(), Synchronize() и UPDATE_THRESHOLD.

Используется в SetShock() и Update().

◆ DealShock()

void DealShock ( )
inlineprivate
114 {
115 if ( GetGame().IsServer() )
116 m_Player.GiveShock( -m_CumulatedShock );
117 }

Перекрестные ссылки GetGame(), m_CumulatedShock и m_Player.

Используется в CheckValue().

◆ GetCurrentShock()

float GetCurrentShock ( )
inlineprotected
97 {
98 return m_Player.m_CurrentShock;
99 }

Перекрестные ссылки m_Player.

◆ GetShock()

float GetShock ( )
inlineprotected
102 {
103 return m_Shock;
104 }

Перекрестные ссылки m_Shock.

◆ LerpVignette()

float LerpVignette ( float x,
float y,
float deltaT )
inlineprivate
166 {
167 float output;
168 output = Math.Lerp( x, y, deltaT );
169 return output;
170 }
Icon x
Icon y
Definition EnMath.c:7
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.

Перекрестные ссылки Math::Lerp(), x и y.

Используется в Update().

◆ NormalizeShockVal()

float NormalizeShockVal ( float shock)
inlineprivate
159 {
160 float base = m_Player.GetMaxHealth("", "Shock") * INTENSITY_FACTOR;
161 float normShock = shock / base;
162 return normShock;
163 }
const int INTENSITY_FACTOR
Definition ShockHandler.c:19

Перекрестные ссылки INTENSITY_FACTOR и m_Player.

Используется в CheckValue() и Update().

◆ SetMultiplier()

float SetMultiplier ( float mult)
inlineprotected
153 {
155 return m_ShockMultiplier;
156 }

Перекрестные ссылки m_ShockMultiplier.

◆ SetShock()

void SetShock ( float dealtShock)
inlineprotected
107 {
109 CheckValue( false );
110 }
void CheckValue(bool forceUpdate)
Definition ShockHandler.c:120

Перекрестные ссылки CheckValue() и m_Shock.

◆ ShockHitEffect()

void ShockHitEffect ( float compareBase)
inlineprivate
174 {
175 float shockDifference = compareBase - m_Player.m_CurrentShock;
176 //Print(shockDifference);
178 {
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 ) );
183 else
184 m_Player.SpawnShockEffect( MiscGameplayFunctions.Normalize( HEAVY_SHOCK_HIT, 100 ) );
185 }
186 }
const int HEAVY_SHOCK_HIT
Definition ShockHandler.c:18
const int LIGHT_SHOCK_HIT
Definition ShockHandler.c:16
const int MID_SHOCK_HIT
Definition ShockHandler.c:17

Перекрестные ссылки HEAVY_SHOCK_HIT, LIGHT_SHOCK_HIT, m_CumulatedShock, m_Player, MID_SHOCK_HIT и UPDATE_THRESHOLD.

Используется в Update().

◆ Synchronize()

void Synchronize ( )
inlineprotected
148 {
150 }
Definition DayZPlayerSyncJunctures.c:5
static void SendShock(DayZPlayer pPlayer, float shockValue)
Definition DayZPlayerSyncJunctures.c:412

Перекрестные ссылки m_Player и DayZPlayerSyncJunctures::SendShock().

Используется в CheckValue().

◆ Update()

void Update ( float deltaT)
inlineprotected
39 {
41
43
44 if ( GetGame().IsClient() )
45 {
46 //Deactivate tunnel vignette when player falls unconscious
47 if ( m_Player.IsUnconscious() )
48 {
50 return;
51 }
52
53 //Deactivate if above visible threshold (also stops "zero bobbing" being sent all the time
54 if ( m_Player.m_CurrentShock >= m_ShockValueThreshold)
55 {
57 return;
58 }
59
60 //Add bobbing to create pulsing effect
61 float val = 0.0;
62 if ( m_Player.m_CurrentShock > m_ShockValueMax * 0.8)
64 float val_adjusted;
65
66 if ( m_Player.m_CurrentShock != (m_PrevVignette * 100) )
67 {
68 //Interpolate between previous level and currently synchronized shock level
70
72 }
73 else
74 {
76 }
77
78 m_Param.param1 = val_adjusted;
80 }
81
83 {
84 //Play the shock hit event (multiply prevVignette by 100 to "Un-Normalize" value)
85 if ( GetGame().IsClient() )
86 {
88 m_PrevVignette = m_Player.m_CurrentShock * 0.01;
89 }
90
91 CheckValue( false );
93 }
94 }
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Definition Easing.c:3
static float EaseInQuart(float t)
Definition Easing.c:56
const float PULSE_PERIOD
Definition ShockHandler.c:22
void ShockHitEffect(float compareBase)
Definition ShockHandler.c:173
float m_LerpRes
Definition ShockHandler.c:14
float LerpVignette(float x, float y, float deltaT)
Definition ShockHandler.c:165
float m_PulseTimer
Definition ShockHandler.c:24
const float PULSE_AMPLITUDE
Definition ShockHandler.c:23
const float VALUE_CHECK_INTERVAL
Definition ShockHandler.c:9
float m_TimeSinceLastTick
Definition ShockHandler.c:11

Перекрестные ссылки CheckValue(), Easing::EaseInQuart(), GetGame(), LerpVignette(), m_LerpRes, m_Param, m_Player, m_PrevVignette, m_PulseTimer, m_ShockValueMax, m_ShockValueThreshold, m_TimeSinceLastTick, NormalizeShockVal(), PULSE_AMPLITUDE, PULSE_PERIOD, ShockHitEffect() и VALUE_CHECK_INTERVAL.

Поля

◆ HEAVY_SHOCK_HIT

const int HEAVY_SHOCK_HIT = 100
private

Используется в ShockHitEffect().

◆ INTENSITY_FACTOR

const int INTENSITY_FACTOR = 1
private

Используется в NormalizeShockVal().

◆ LIGHT_SHOCK_HIT

const int LIGHT_SHOCK_HIT = 33
private

Используется в ShockHitEffect().

◆ m_CumulatedShock

float m_CumulatedShock
protected

Используется в CheckValue(), DealShock() и ShockHitEffect().

◆ m_LerpRes

float m_LerpRes
private

Используется в Update().

◆ m_Param

ref Param1<float> m_Param
protected

Используется в ShockHandler() и Update().

◆ m_Player

◆ m_PrevVignette

float m_PrevVignette
private

Используется в CheckValue(), ShockHandler() и Update().

◆ m_PulseTimer

float m_PulseTimer
private

Используется в Update().

◆ m_Shock

float m_Shock
protected

Используется в CheckValue(), GetShock() и SetShock().

◆ m_ShockMultiplier

float m_ShockMultiplier = 1
private

Используется в CheckValue() и SetMultiplier().

◆ m_ShockValueMax

float m_ShockValueMax
protected

Используется в ShockHandler() и Update().

◆ m_ShockValueThreshold

float m_ShockValueThreshold
protected

Используется в ShockHandler() и Update().

◆ m_TimeSinceLastTick

float m_TimeSinceLastTick = VALUE_CHECK_INTERVAL + 1
private

Используется в Update().

◆ MID_SHOCK_HIT

const int MID_SHOCK_HIT = 67
private

Используется в ShockHitEffect().

◆ PULSE_AMPLITUDE

const float PULSE_AMPLITUDE = 0.05
private

Используется в Update().

◆ PULSE_PERIOD

const float PULSE_PERIOD = 0.5
private

Используется в Update().

◆ UPDATE_THRESHOLD

const float UPDATE_THRESHOLD = 3
protected

Используется в CheckValue() и ShockHitEffect().

◆ VALUE_CHECK_INTERVAL

const float VALUE_CHECK_INTERVAL = 0.95
protected

Используется в Update().


Объявления и описания членов класса находятся в файле: