DayZ 1.24
Loading...
Searching...
No Matches
PPERContaminated.c
Go to the documentation of this file.
1// PPE when player is in contaminated area trigger
3{
4 protected vector m_StartRGB = vector.Zero;
5 protected float m_AccumulatedTime = 0;
6 protected bool m_FadeIn = false;
7 protected bool m_FadeOut = false;
8
9 const float FADE_TIME = 3;
10 // the end result is 1 - the value set here
11 const float R_TARGET = 0.142; // end value 0.858
12 const float G_TARGET = 0.15; // end value 0.850
13 const float B_TARGET = 0.44; // end value 0.560
14
15 override protected void OnStart(Param par = null)
16 {
17 super.OnStart(par);
18
19 m_AccumulatedTime = 0;
20
21 m_FadeIn = true;
22 m_FadeOut = false;
23
26 }
27
28 override protected void OnUpdate(float delta)
29 {
30 super.OnUpdate(delta);
31
32 if (m_FadeIn && m_AccumulatedTime <= FADE_TIME)
33 {
34 m_AccumulatedTime += delta;
35
36 m_StartRGB[0] = 1 - FadeColourMult(0, 1, m_AccumulatedTime / FADE_TIME) * R_TARGET;
37 m_StartRGB[1] = 1 - FadeColourMult(0, 1, m_AccumulatedTime / FADE_TIME) * G_TARGET;
38 m_StartRGB[2] = 1 - FadeColourMult(0, 1, m_AccumulatedTime / FADE_TIME) * B_TARGET;
39
40 SetTargetValueColor(PostProcessEffectType.Glow, PPEGlow.PARAM_COLORIZATIONCOLOR, {m_StartRGB[0], m_StartRGB[1], m_StartRGB[2], 0.0}, PPEGlow.L_23_TOXIC_TINT, PPOperators.MULTIPLICATIVE);
41 }
42
43 if (m_FadeOut)
44 {
45 if (m_AccumulatedTime <= FADE_TIME)
46 {
47 m_AccumulatedTime += delta;
48
49 m_StartRGB[0] = (1 - R_TARGET) + FadeColourMult(0, R_TARGET, m_AccumulatedTime / FADE_TIME);
50 m_StartRGB[1] = (1 - G_TARGET) + FadeColourMult(0, G_TARGET, m_AccumulatedTime / FADE_TIME);
51 m_StartRGB[2] = (1 - B_TARGET) + FadeColourMult(0, B_TARGET, m_AccumulatedTime / FADE_TIME);
52
53 SetTargetValueColor(PostProcessEffectType.Glow, PPEGlow.PARAM_COLORIZATIONCOLOR, {m_StartRGB[0], m_StartRGB[1], m_StartRGB[2], 0.0}, PPEGlow.L_23_TOXIC_TINT, PPOperators.MULTIPLICATIVE);
54 }
55 else
56 {
57 Stop(); //proper termination after a fadeout
58 }
59 }
60 }
61
62 override void OnStop(Param par = null)
63 {
64 m_FadeIn = false;
65 m_FadeOut = false;
67
68 if (par && Class.CastTo(p, par))
69 m_FadeOut = p.param1;
70
71 m_AccumulatedTime = 0;
72
73 super.OnStop(par);
74 }
75
76 // Lerped multiplier for RGBA values
77 protected float FadeColourMult(float x, float y, float deltaT)
78 {
79 float output;
80 output = Math.Lerp(x, y, deltaT);
82 return output;
83 }
84}
void Stop()
Stops all elements this effect consists of.
Definition Effect.c:175
Icon x
Icon y
PPOperators
PP operators, specify operation between subsequent layers.
void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)
void SetTargetValueColor(int mat_id, int param_idx, ref array< float > val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)
Super root of all classes in Enforce script.
Definition EnScript.c:11
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Definition Easing.c:3
static float EaseInOutSine(float t)
Definition Easing.c:14
Definition EnMath.c:7
FilmGrain - PostProcessEffectType.FilmGrain.
Definition PPEFilmGrain.c:7
static const int L_1_TOXIC_TINT
static const int PARAM_SHARPNESS
Definition PPEFilmGrain.c:9
static const int L_2_TOXIC_TINT
static const int PARAM_GRAINSIZE
Glow - PostProcessEffectType.Glow.
Definition PPEGlow.c:8
static const int PARAM_COLORIZATIONCOLOR
Definition PPEGlow.c:32
static const int L_23_TOXIC_TINT
Definition PPEGlow.c:53
base, not to be used directly, would lead to layering collisions!
override void OnStop(Param par=null)
float FadeColourMult(float x, float y, float deltaT)
void OnStart(Param par=null)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
static const vector Zero
Definition EnConvert.c:110
PostProcessEffectType
Post-process effect type.
Definition EnWorld.c:72
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.