DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
KuruShake.c
См. документацию.
2{
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;
8
10 float m_Time;
11 float m_Time2;
15
16
18
19 void KuruShake(PlayerBase player, float amount)
20 {
21
22 vector pos1;
23 int seed = Math.Randomize(player.GetRandomGeneratorSyncManager().GetRandomInRange(RandomGeneratorSyncUsage.RGSGeneric,0,10000));
28 pos1.Normalize();
29 pos1 = pos1 * m_ShakeStrength;
30
31 vector pos2;
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");
35 m_Curve.Insert(pos1);
36 m_Curve.Insert(pos2);
37
38 /*
39 Print("==========================");
40 for(int i = 0; i < m_Curve.Count(); i++)
41 {
42 Print(m_Curve[i]);
43 }
44 Print("==========================");
45 */
46 }
47
48 void Update(float delta_time, out float pos_x, out float pos_y )
49 {
50 if(m_RelativeTime < 0.99)
51 {
52 m_Time += delta_time;
54 //m_RelativeTime = m_RelativeTime - 0.01;
57 pos_x = pos[0];
58 pos_y = pos[1];
59 }
60 else
61 {
62 m_Time2 += delta_time * 1;
66 pos_x = pos2[0];
67 pos_y = pos2[1];
68 }
69
70 if(m_Time2 >= 0.99)
71 {
72 delete this;
73 }
74 }
75
76
77
78}
RandomGeneratorSyncUsage
Определения RandomGeneratorSyncManager.c:2
static float EaseInQuint(float t)
Определения Easing.c:78
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Определения Easing.c:3
const float SHAKE_DURATION_PHASE1
Определения KuruShake.c:5
PlayerBase m_Player
Определения KuruShake.c:9
float m_RelativeTime
Определения KuruShake.c:12
float m_Time2
Определения KuruShake.c:11
const float RANDOM_RANGE_POINT
Определения KuruShake.c:3
const float SHAKE_STRENGTH_MIN
Определения KuruShake.c:6
void KuruShake(PlayerBase player, float amount)
Определения KuruShake.c:19
float m_RelativeTime2
Определения KuruShake.c:13
ref array< vector > m_Curve
Определения KuruShake.c:17
const float RANDOM_RANGE_DEVIATION
Определения KuruShake.c:4
float m_ShakeStrength
Определения KuruShake.c:14
const float SHAKE_STRENGTH_MAX
Определения KuruShake.c:7
void Update(float delta_time, out float pos_x, out float pos_y)
Определения KuruShake.c:48
float m_Time
Определения KuruShake.c:10
Определения EnMath3D.c:28
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto float Normalize()
Normalizes vector. Returns length.
Определения EnConvert.c:106
ECurveType
Определения EnMath3D.c:21
static proto native vector Curve(ECurveType type, float param, notnull array< vector > points)
Computes curve.
static proto int Randomize(int seed)
Sets the seed for the random number generator.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...