3 const float RANDOM_RANGE_POINT = 1;
4 const float RANDOM_RANGE_DEVIATION = 0.50;
5 const float SHAKE_DURATION_PHASE1 = 0.01;
6 const float SHAKE_STRENGTH_MIN = 1;
7 const float SHAKE_STRENGTH_MAX = 5;
13 float m_RelativeTime2;
14 float m_ShakeStrength;
24 Math.RandomFloat(-RANDOM_RANGE_POINT,RANDOM_RANGE_POINT);
25 m_ShakeStrength =
Math.Lerp(SHAKE_STRENGTH_MIN, SHAKE_STRENGTH_MAX, amount);
26 pos1[0] =
Math.RandomFloat(-RANDOM_RANGE_POINT,RANDOM_RANGE_POINT);
27 pos1[1] =
Math.RandomFloat(-RANDOM_RANGE_POINT,RANDOM_RANGE_POINT);
29 pos1 = pos1 * m_ShakeStrength;
32 pos2[0] = pos1[0] +
Math.RandomFloat(-RANDOM_RANGE_DEVIATION,RANDOM_RANGE_DEVIATION) + pos1[0];
33 pos2[1] = pos1[1] +
Math.RandomFloat(-RANDOM_RANGE_DEVIATION,RANDOM_RANGE_DEVIATION) + pos1[1];
34 m_Curve.Insert(
"0 0 0");
48 void Update(
float delta_time, out
float pos_x, out
float pos_y )
50 if(m_RelativeTime < 0.99)
53 m_RelativeTime =
Math.InverseLerp(0, SHAKE_DURATION_PHASE1,
m_Time);
55 m_RelativeTime =
Easing.EaseInQuint(m_RelativeTime);
62 m_Time2 += delta_time * 1;
63 m_RelativeTime2 = 1 - m_Time2;
64 m_RelativeTime2 =
Easing.EaseInQuint(m_RelativeTime2);