6 protected float m_fCurrent;
7 protected float m_fVelocity;
8 protected float m_fMaxVelocity;
10 protected float m_fLinearMagnitude;
11 protected float m_fAngularMagnitude;
13 protected float m_fInTime;
14 protected float m_fSustainTime;
15 protected float m_fOutTime;
17 protected float m_fElapsedTime;
18 protected float m_fDuration;
20 override void Update(IEntity owner,
float timeSlice)
32 smoothTime = m_fInTime;
38 smoothTime = m_fSustainTime;
44 smoothTime = m_fOutTime;
51 m_fCurrent = Math.SmoothCD(m_fCurrent, targetValue, m_fVelocity, smoothTime, m_fMaxVelocity, timeSlice);
54 m_vTranslation = m_fLinearMagnitude * m_fCurrent *
56 Math.RandomFloat(-0.005, 0.005),
57 Math.RandomFloat(-0.005, 0.005),
60 m_vRotation = m_fAngularMagnitude * m_fCurrent *
62 Math.RandomFloat(-0.25, 0.25),
63 Math.RandomFloat(-0.25, 0.25),
64 Math.RandomFloat(-1, 1)
70 if (targetValue <= 0 && m_fCurrent <= 0.0001)
75 m_vTranslation = vector.Zero;
76 m_vRotation = vector.Zero;
81 void SetParams(
float linearMagnitude,
float angularMagnitude,
float inTime,
float sustainTime,
float outTime)
83 m_fLinearMagnitude = linearMagnitude;
84 m_fAngularMagnitude = angularMagnitude;
86 m_fSustainTime = sustainTime;
92 if (m_fInTime <= 0.0 || m_fOutTime <= 0.0)
94 Print(
"Camera Shake: In and out time can not be less or equal to zero!", LogLevel.ERROR);
101 m_fMaxVelocity = 10.0;
103 m_fDuration = m_fInTime + m_fSustainTime + m_fOutTime;
109 override void Clear()
112 m_bIsRunning =
false;