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);
51 m_BreakPoint =
Math.Clamp(m_BreakPointBase * m_Duration,0,m_Duration);
52 m_Scatter =
Math.Clamp(m_Scatter,0.0,180.0);
53 m_HitDirection = hit_direction + (
Math.RandomFloatInclusive(0,m_Scatter) *
Math.Pow(-1.0,
Math.RandomIntInclusive(0,1)));
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;
151 m_PosXScreenEdge =
Math.Clamp(
Math.Sin(m_AngleRad)/
Math.Sin(
Math.PI/4),-1,1) * ( m_SizeXEnf/2 + m_DistanceAdjust * m_SizeXEnf);
152 m_PosYScreenEdge =
Math.Clamp(-1 *
Math.Cos(m_AngleRad)/
Math.Cos(
Math.PI/4),-1,1) * ( m_SizeYEnf/2 + m_DistanceAdjust * m_SizeYEnf);
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;
173 static protected typename m_Type;
174 static float m_DurationMax;
175 static float m_BreakPointBase;
176 static float m_DistanceAdjust;
177 static int m_RotationOverride;
178 static float m_Scatter;
181 static void CheckValues()
184 if (m_ServerOverrideEnabled)
196 m_ID = HitIndicatorType.SPLASH;
197 m_Color = HitDirectionConstants.COLOR_DEFAULT;
198 m_DurationMax = HitDirectionConstants.DURATION_BASE;
199 m_BreakPointBase = HitDirectionConstants.BREAKPOINT_BASE;
200 m_Scatter = HitDirectionConstants.SCATTER;
202 m_DistanceAdjust = HitDirectionConstants.DISTANCE_ADJUST;
203 m_RotationOverride = HitDirectionConstants.ROTATION_DEFAULT;
206 static typename GetCurrentType()
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;