5 const float DURATION_COEF_MIN = 0.6;
6 const float INTENSITY_MIN = 0.6;
24 float m_PosXScreenEdge;
25 float m_PosYScreenEdge;
40 m_ImageData = GetImageData();
41 m_ImageData.GetCurrentImageData(m_LayoutRoot,m_Image);
45 void Init(
DayZPlayer player,
float hit_direction,
float intensity_max)
48 float duration_coef =
Math.Clamp(intensity_max,DURATION_COEF_MIN,1);
49 m_IntensityMax =
Math.Clamp(intensity_max,INTENSITY_MIN,1);
53 m_HitDirection = hit_direction + (
Math.RandomFloatInclusive(0,
m_Scatter) *
Math.Pow(-1.0,
Math.RandomIntInclusive(0,1)));
55 Widget w = m_LayoutRoot;
63 m_Image.SetColor(m_Color);
65 m_LayoutRoot.Show(
true);
67 CalculateArrowPosition();
68 SetIndicatorRotation();
69 SetIndicatorPositon();
77 m_LayoutRoot.Show(
false);
83 if ( m_TimeActive >= m_Duration )
90 void Update(
float timeslice )
94 if ( m_TimeActive <= m_BreakPoint )
96 intensity = m_IntensityMax;
100 float tmp_value =
Math.InverseLerp(m_BreakPoint, m_Duration, m_TimeActive);
101 intensity =
Math.Lerp(m_IntensityMax,0.0,tmp_value);
105 intensity =
Math.Clamp(intensity,0,1);
107 if ( m_TimeActive >= m_Duration )
109 m_LayoutRoot.Show(
false);
113 m_LayoutRoot.SetAlpha(intensity);
116 CalculateArrowPosition(timeslice);
117 SetIndicatorPositon(timeslice);
118 SetIndicatorRotation(timeslice);
123 void CalculateArrowPosition(
float timeslice = -1.0)
125 m_HitDirection =
Math.NormalizeAngle(m_HitDirection);
127 float angle_direction =
m_Player.GetOrientation()[0];
128 angle_direction =
Math.NormalizeAngle(angle_direction);
129 float camera_angle =
GetGame().GetCurrentCameraDirection().VectorToAngles()[0];
130 camera_angle =
Math.NormalizeAngle(camera_angle);
132 float angle_camera_diff = angle_direction - camera_angle;
133 m_AngleRad = m_HitDirection + angle_camera_diff;
134 m_AngleRad =
Math.NormalizeAngle(m_AngleRad);
135 m_AngleRad = m_AngleRad *
Math.DEG2RAD;
142 if ( m_Initialized && timeslice != -1.0 )
144 float val = m_AngleRadPrev - m_AngleRad +
Math.PI;
147 m_AngleRad = m_AngleRadPrev -
Math.SmoothCD(0, val, m_SmoothVel, 0.1, 1000, timeslice);
149 m_AngleRadPrev = m_AngleRad;
154 FinalizePositionCalculation();
158 void FinalizePositionCalculation(){}
159 void SetIndicatorRotation(
float timeslice = -1.0){}
161 void SetIndicatorPositon(
float timeslice = -1.0)
163 m_LayoutRoot.SetPos(m_PosX,m_PosY,
true);
169 static bool m_ServerOverrideEnabled;
184 if (m_ServerOverrideEnabled)
196 m_ID = HitIndicatorType.SPLASH;
197 m_Color = HitDirectionConstants.COLOR_DEFAULT;
200 m_Scatter = HitDirectionConstants.SCATTER;
210 case HitIndicatorType.SPLASH:
211 m_Type = HitDirectionEffectSplash;
214 case HitIndicatorType.SPIKE:
215 m_Type = HitDirectionEffectSpike;
218 case HitIndicatorType.ARROW:
219 m_Type = HitDirectionEffectArrow;
224 m_Type = HitDirectionEffectSplash;
class DamageDealtEffect m_TimeActive
static int m_RotationOverride
static float m_DurationMax
static float m_BreakPointBase
static void CheckValues()
range 0..180, randomized offset of direction to make it less acurate
static float m_DistanceAdjust
range 0..1, a point where the fading starts
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
proto native CGame GetGame()
proto void GetScreenSize(out int x, out int y)