Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
bullethitreaction.c
Go to the documentation of this file.
2 {
3  const float ALPHA_MIN = 0;
4  const float ALPHA_MAX = 1;
5  float m_HitDuration;
6  float m_BreakPoint;
7  float m_TimeActive;
8  PPERequester_HealthHitReaction m_Requester;
9 
10  void DamageDealtEffect()
11  {
12  m_HitDuration = 0.10;
13  m_BreakPoint = 0.05;
14  Class.CastTo(m_Requester, PPERequesterBank.GetRequester(PPERequester_HealthHitReaction));
15  //Print("=====================================================");
16  //Print("=====================================================");
17  }
18 
19  void ~DamageDealtEffect()
20  {
21  PPERequesterBank.GetRequester(PPERequester_HealthHitReaction).Stop();
22  }
23 
24  void Update(float deltatime)
25  {
26  float value;
27 
28  if( m_TimeActive <= m_BreakPoint )
29  {
30  value = Math.InverseLerp(0, m_BreakPoint, m_TimeActive);
31  }
32  else
33  {
34  float tmp_value = Math.InverseLerp(m_BreakPoint, m_HitDuration, m_TimeActive);
35  value = 1 - tmp_value;
36  }
37  m_TimeActive += deltatime;
38  value = Math.Clamp(value,0,1);
39  float val = Math.Lerp(ALPHA_MIN, ALPHA_MAX, value);
40  //Print(val);
41  m_Requester.SetHitIntensity(val);
42 
43  if(m_TimeActive >= m_HitDuration)
44  {
45  delete this;
46  }
47  }
48 
49 }
50 
51 class EffectRadial
52 {
53 
54  float m_TimeActive;
55  float m_Divisor = 16;
56  float m_Duration = 0.6;
57  PPERequester_PainBlur m_PPERequester;
58 
59  void EffectRadial(Param param1, Param param2)
60  {
61  if (param1)
62  {
64  if (p1)
65  {
66  m_Divisor = p1.param1;
67  m_Duration = p1.param2;
68  }
69  }
70 
71  if ( Class.CastTo( m_PPERequester, PPERequesterBank.GetRequester( PPERequesterBank.REQ_PAINBLUR ) ) )
72  m_PPERequester.Start();
73  }
74 
76  {
77  if(m_PPERequester)
78  m_PPERequester.SetRadialBlur(0,0,0,0);
79  }
80 
81  void Update(float deltatime)
82  {
83 
84  float time = Math.InverseLerp(0, m_Duration, m_TimeActive);
85  float value = 1 - Easing.EaseInQuart(time);
86  float strenght = value / m_Divisor; //The divisor matches the ease curve used
87 
88  if(m_PPERequester)
89  m_PPERequester.SetRadialBlur(strenght, strenght, 1 - value, 1 - value);
90 
91 
92 
93  m_TimeActive += deltatime;
95  {
96  delete this;
97  }
98  }
99 }
Param2< float, float >
m_Requester
protected PPERUndergroundAcco m_Requester
Definition: undergroundhandlerclient.c:22
Param
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition: param.c:11
m_Duration
float m_Duration
Definition: bullethitreaction.c:56
m_Divisor
float m_Divisor
Definition: bullethitreaction.c:55
Easing
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Definition: easing.c:2
DamageDealtEffect
Definition: bullethitreaction.c:1
~EffectRadial
void ~EffectRadial()
Definition: bullethitreaction.c:75
Update
void Update(float deltatime)
Definition: bullethitreaction.c:81
m_TimeActive
class DamageDealtEffect m_TimeActive
m_PPERequester
PPERequester_PainBlur m_PPERequester
Definition: bullethitreaction.c:57
EffectRadial
void EffectRadial(Param param1, Param param2)
Definition: bullethitreaction.c:59
Math
Definition: enmath.c:6
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10