DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ CalculateDamageScale()

float AreaDamageLooped::CalculateDamageScale ( TriggerInsider insider,
float deltaTime )
inlineprotected

См. определение в файле AreaDamageLooped.c строка 74

75 {
76 // If we want the LoopInterval to be dependant on the Object, we will need their lastDamaged time
78 {
79 float lastDamaged = 0;
80
81 AreaDamageTriggerInsider dInsider;
82 if ( CastTo( dInsider, insider ) )
83 lastDamaged = dInsider.lastDamaged;
84
85 // First time it is damaged, do full damage
86 if (lastDamaged == 0)
87 return 1;
88
89 // This way, in case the server lags, it will scale the damage to catch up if necessary
90 // We want to wait until it is at least above 1, to not spam the network with hit messages
91 float damageCoeff = (m_CurrentTime - lastDamaged) / m_LoopInterval;
92 if ( damageCoeff >= 1 )
93 return damageCoeff;
94
95 return 0;
96 }
97 else
98 {
99 return m_AmountOfLoops;
100 }
101 }
float m_CurrentTime
Current start time in seconds.
Определения AreaDamageLooped.c:4
int m_AmountOfLoops
Caching of the amount of loops that will be performed in this frame.
Определения AreaDamageLooped.c:13
bool m_LoopByObject
Decides if the looping will be using the Object as reference or the time since last update loop.
Определения AreaDamageLooped.c:16
float m_LoopInterval
Loop interval in seconds.
Определения AreaDamageLooped.c:10
float lastDamaged
Last time the object was damaged in seconds.
Определения AreaDamageTriggerBase.c:5

Перекрестные ссылки AreaDamageTriggerInsider::lastDamaged, m_AmountOfLoops, m_CurrentTime, m_LoopByObject и m_LoopInterval.