DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ Update()

override void Update ( float timeSlice = 0)
protected

См. определение в файле BoatWaterEffects.c строка 66

67 {
68 if (m_Boat.GetCurrentGear() == 0)
69 {
70 if (IsPlaying())
71 {
73 GetParticle().SetParticleParam(EmitorParam.BIRTH_RATE_RND, 0);
74 Stop();
75 }
76
77 return;
78 }
79
80 super.Update(timeSlice);
81
82 Particle ptc = GetParticle();
83 float lerp1, lerp2;
84
85 vector velocity = dBodyGetVelocityAt(m_Boat, m_Boat.CoordToParent(GetLocalPosition()));
86 float speed = velocity.Normalize() * 3.6; // to km/h
87 UpdateSpeedState(ptc, speed);
88
89 UpdatePosToSeaLevel(timeSlice, -0.2);
90
91 lerp1 = Math.InverseLerp(0, m_SpeedFast, speed);
92 lerp2 = Math.InverseLerp(m_SpeedMedium - 5, m_SpeedFast + 10, speed);
93
94 for (int i = 0; i < m_EmitorCount; i++)
95 {
96 if (i == 11 || i == 12) // waves
97 {
98 ptc.SetParameter(i, EmitorParam.VELOCITY, ptc.GetParameterOriginal(i, EmitorParam.VELOCITY) * lerp1);
99 }
100 else if (i < 5 || i == 7 || i == 8) // splashes
101 {
102 if (m_SpeedState > EBoatSpeed.SLOW)
103 {
104 if (GetGame().GetWaterDepth(m_Boat.CoordToParent(m_MemPointPos)) < -0.1) // when the front of the boat is above water, disable the emitor
105 EnableEmitor(ptc, i, false);
106 else
107 EnableEmitor(ptc, i, true);
108
109 ptc.SetParameter(i, EmitorParam.SIZE, ptc.GetParameterOriginal(i, EmitorParam.SIZE) * lerp2);
110 }
111 }
112 }
113 }
EBoatSpeed
Определения BoatWaterEffects.c:2
void UpdateSpeedState(Particle ptc, float speed)
Определения BoatWaterEffects.c:24
bool IsPlaying()
Returns true when the Effect is playing, false otherwise.
Определения Effect.c:195
vector GetLocalPosition()
Get the local position of the Effect.
Определения Effect.c:488
proto native ParticleSource GetParticle(int index)
Manually get the particle at index.
Определения EnMath.c:7
float GetParameterOriginal(int emitter, int parameter)
Определения Particle.c:663
void SetParameter(int emitter, int parameter, float value)
Set the value of a parameter of an emitor in the particle.
Определения Particle.c:625
Legacy way of using particles in the game.
Определения Particle.c:7
override void SetParticleParam(int parameter_id, float value)
Set the value of a parameter of all emitors in the particle.
Определения ParticleSource.c:808
proto float Normalize()
Normalizes vector. Returns length.
Определения EnConvert.c:106
proto native CGame GetGame()
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
EmitorParam
Определения EnVisual.c:114
proto native vector dBodyGetVelocityAt(notnull IEntity body, vector globalpos)
void Stop()
Stops all elements this effect consists of.
Определения Effect.c:181

Перекрестные ссылки dBodyGetVelocityAt(), EffectBoatWaterBase::EnableEmitor(), GetGame(), GetLocalPosition(), Particle::GetParameterOriginal(), EffectParticle::GetParticle(), Math::InverseLerp(), IsPlaying(), vector::Normalize(), Particle::SetParameter(), Particle::SetParticleParam(), EffectParticle::Stop(), EffectBoatWaterBase::UpdatePosToSeaLevel() и EffectBoatWaterBase::UpdateSpeedState().