DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
GEWidgetsMetaDataEyeVeins.c
См. документацию.
1
3{
4 protected const float TOP_PART_IRRITATION_MIN_Y_POSITION = -512;
5 protected const float TOP_PART_IRRITATION_MAX_Y_POSITION = 0;
6 protected const float BOTTOM_PART_IRRITATION_MIN_Y_POSITION = -512;
7 protected const float BOTTOM_PART_IRRITATION_MAX_Y_POSITION = 0;
8
9 protected bool m_Initialized;
10 protected bool m_Visible;
11 protected bool m_IsActive;
12
13 // Passed from modifier -> symptom -> effect
14 protected float m_Amount;
15
16 protected float m_TargetAmount = 0.0;
17 protected float m_CurrentAmount = 0.0;
18
19 protected Widget m_EyeFrame;
20 protected ImageWidget m_TopPartIrritation;
21 protected ImageWidget m_BottomPartIrritation;
22 protected ImageWidget m_VeinsLayer;
23 protected int m_LidsColorCorrection;
25
26 protected static float m_MaskSmoothVelocity[1];
27 protected static float m_TransitionWidthSmoothVelocity[1];
28
30 {
31 m_Visible = false;
32 m_VeinsLayer.SetMaskProgress(0.0);
33 m_VeinsLayer.SetMaskTransitionWidth(0.0);
34 }
35
36 override void Init(array<ref Widget> input, int type, Widget layout_root, int user_override = -1)
37 {
38 super.Init(input, type, layout_root, user_override);
39
40 m_EyeFrame = m_LayoutRoot.FindAnyWidgetById(EffectWidgetsTypes.EYE_VEINS);
42
43 m_VeinsLayer = ImageWidget.Cast(m_EyeFrame.FindWidget("veinsLayer"));
44 m_VeinsLayer.SetMaskProgress(0.0);
45 m_VeinsLayer.SetMaskTransitionWidth(0.0);
46 m_VeinsLayer.Show(false);
47
48 m_TopPartIrritation = ImageWidget.Cast(m_EyeFrame.FindWidget("topPartIrritation"));
49 m_TopPartIrritation.Show(false);
50
51 m_BottomPartIrritation = ImageWidget.Cast(m_EyeFrame.FindWidget("bottomPartIrritation"));
52 m_BottomPartIrritation.Show(false);
53
54 m_Initialized = true;
55 m_Visible = true;
56 }
57
58 override bool HasDefinedHandle()
59 {
60 return true;
61 }
62
63 override bool DataInitialized()
64 {
65 return m_Initialized;
66 }
67
68 override void Update(float timeSlice = 0, Param p = null, int handle = -1)
69 {
70 if (p)
71 {
72 Param1<float> params;
73 if (Class.CastTo(params, p))
74 {
75 m_Amount = params.param1;
76 m_TargetAmount = Math.Clamp(m_Amount, 0.0, 1.0);
77 m_IsActive = m_Amount > 0.0 || m_TargetAmount > 0.0;
78 UpdateVeins(timeSlice);
79 }
80 }
81 }
82
91
92 protected void SetVeinsAmount(float amount, float timeSlice)
93 {
94 if (m_VeinsLayer)
95 {
97
98 float maskProgress = amount;
99 maskProgress = Math.SmoothCD(maskProgress, amount + Math.RandomFloatInclusive(-0.5, 0.0), m_MaskSmoothVelocity, 0.4, 10000, timeSlice);
100 maskProgress = Math.Clamp(maskProgress, 0.0, 0.4);
101 m_VeinsLayer.SetMaskProgress(maskProgress);
102
103
104 float transitionWidth = Easing.EaseInOutSine(amount);
105 transitionWidth = 1;
106 m_VeinsLayer.SetMaskTransitionWidth(transitionWidth);
107 }
108 }
109
110 protected void SetIrritation(float amount, float timeSlice)
111 {
112 const float ALPHA_MULTIPLIER_MIN = 0.1;
113 const float ALPHA_MULTIPLIER_MAX = 0.25;
114
115 int dayTime = g_Game.GetMission().GetWorldData().GetDaytime();
116 float dayTimeValueOverride = 1.0;
117 switch (dayTime)
118 {
122 dayTimeValueOverride = 0.1;
123 break;
124 }
125 float alphaMultiplier = Math.Lerp(ALPHA_MULTIPLIER_MIN, ALPHA_MULTIPLIER_MAX, amount);
126 m_LidsColorCorrection = ARGBF(1.0 * alphaMultiplier, 0.45 * dayTimeValueOverride, 0.0, 0.0);
127
131
135 }
136
137 protected void SetVeinsColor()
138 {
139 const float HDR_MIN = 0.005;
140 const float HDR_MAX = 1.0;
141 const float COLOR_MULTIPLIER_MIN = 0.1;
142 const float COLOR_MULTIPLIER_MAX = 0.5;
143
144 float hdrMultiplier = GetSceneHDRMul(0);
145 hdrMultiplier = Math.Clamp(hdrMultiplier ,HDR_MIN, HDR_MAX);
146 hdrMultiplier = Math.InverseLerp(HDR_MIN, HDR_MAX, hdrMultiplier);
147 hdrMultiplier = Math.Lerp(COLOR_MULTIPLIER_MAX, COLOR_MULTIPLIER_MIN, hdrMultiplier);
148 m_VeinsColorCorrection = ARGBF(1.0 * hdrMultiplier, 1.0 * hdrMultiplier, 1.0 * hdrMultiplier, 1.0 * hdrMultiplier); //grayscaling of the image
150 }
151
152 override void UpdateVisibility(bool state)
153 {
154 Widget w = m_EyeFrame;
155 while (w && w != m_LayoutRoot && m_Visible == state && w.IsVisibleHierarchy() != state)
156 {
157 w.Show(state);
158 w = w.GetParent();
159 }
160 }
161
163 override void ForceStop()
164 {
165 super.ForceStop();
166
167 Update();
168 }
169}
DayZGame g_Game
Определения DayZGame.c:4074
Super root of all classes in Enforce script.
Определения EnScript.c:11
static float EaseInOutSine(float t)
Определения Easing.c:14
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Определения Easing.c:3
Manages all bleeding indicators and their updates.
Определения GEWidgetsMetaDataBleeding.c:4
const float BOTTOM_PART_IRRITATION_MIN_Y_POSITION
[px]
Определения GEWidgetsMetaDataEyeVeins.c:6
bool m_IsActive
overall visibility
Определения GEWidgetsMetaDataEyeVeins.c:11
override void UpdateVisibility(bool state)
Определения GEWidgetsMetaDataEyeVeins.c:152
override bool HasDefinedHandle()
Определения GEWidgetsMetaDataEyeVeins.c:58
override bool DataInitialized()
Определения GEWidgetsMetaDataEyeVeins.c:63
void SetIrritation(float amount, float timeSlice)
Определения GEWidgetsMetaDataEyeVeins.c:110
const float TOP_PART_IRRITATION_MIN_Y_POSITION
Определения GEWidgetsMetaDataEyeVeins.c:4
const float TOP_PART_IRRITATION_MAX_Y_POSITION
[px]
Определения GEWidgetsMetaDataEyeVeins.c:5
override void ForceStop()
stops and re-sets indicators and images even out of sequence. Should still be tied to the 'player' up...
Определения GEWidgetsMetaDataEyeVeins.c:163
override void Init(array< ref Widget > input, int type, Widget layout_root, int user_override=-1)
Определения GEWidgetsMetaDataEyeVeins.c:36
ImageWidget m_BottomPartIrritation
Определения GEWidgetsMetaDataEyeVeins.c:21
override void Update(float timeSlice=0, Param p=null, int handle=-1)
Определения GEWidgetsMetaDataEyeVeins.c:68
static float m_TransitionWidthSmoothVelocity[1]
Определения GEWidgetsMetaDataEyeVeins.c:27
void SetVeinsAmount(float amount, float timeSlice)
Определения GEWidgetsMetaDataEyeVeins.c:92
static float m_MaskSmoothVelocity[1]
Определения GEWidgetsMetaDataEyeVeins.c:26
const float BOTTOM_PART_IRRITATION_MAX_Y_POSITION
[px]
Определения GEWidgetsMetaDataEyeVeins.c:7
Manages eye veins effects.
Определения GEWidgetsMetaDataEyeVeins.c:3
Определения EnMath.c:7
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
Определения EnWidgets.c:190
static int NIGHT
Определения WorldData.c:611
static int DUSK
Определения WorldData.c:613
static int EVENING
Определения WorldData.c:618
Определения WorldData.c:609
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
proto native float GetSceneHDRMul(int camera)
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Определения EnMath.c:106
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'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float SmoothCD(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt)
Does the CD smoothing function - easy in | easy out / S shaped smoothing.
proto native volatile void Update()
Определения PlayerSoundManager.c:125
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
Определения proto.c:332