12 [
Attribute(defvalue:
"100",
UIWidgets.Slider,
desc:
"Sounds will not be trigger if distance is less than this.",
"0 5000 1")]
13 protected float m_fTriggerDistanceMin;
15 [
Attribute(defvalue:
"1000",
UIWidgets.Slider,
"Sounds will not be trigged if distance is greater than this.",
"0 5000 1")]
16 protected float m_fTriggerDistanceMax;
19 protected int m_iRepCount;
22 protected int m_iRepCountRnd;
25 protected float m_iRepTime;
27 [
Attribute(
"10",
UIWidgets.Slider,
"Repetition time randomization [seconds]",
"0 30 0.001")]
28 protected float m_iRepTimeRnd;
30 [
Attribute(
"20",
UIWidgets.Slider,
"Sequence reprtition time [seconds]",
"0 60 0.001")]
31 protected float m_iSequenceRepTime;
33 [
Attribute(
"20",
UIWidgets.Slider,
"Sequence repetition randomization [seconds]",
"0 60 0.001")]
34 protected float m_iSequenceRepTimeRnd;
37 protected float m_fTriggerTime;
39 protected int m_iRepCountCurent;
42 private int GetRepCount()
44 return Math.RandomIntInclusive(
Math.Max(0, m_iRepCount - m_iRepCountRnd), m_iRepCount + m_iRepCountRnd);
48 private float GetRepTime()
50 if (m_iRepTimeRnd < 0.001)
56 return Math.RandomFloatInclusive(Math.Max(0, m_iRepTime - m_iRepTimeRnd), m_iRepTime + m_iRepTimeRnd);
61 private float GetSequenceRepTime()
63 if (m_iSequenceRepTimeRnd < 0.001)
65 return m_iSequenceRepTime;
69 return Math.RandomFloatInclusive(Math.Max(0, m_iSequenceRepTime - m_iSequenceRepTimeRnd), m_iSequenceRepTime + m_iSequenceRepTimeRnd);
80 owner.
GetWorld().GetCurrentCamera(matCamera);
82 const float distance = vector.Distance(matOwner[3], matCamera[3]);
83 return Math.IsInRange(
distance, m_fTriggerDistanceMin, m_fTriggerDistanceMax);
98 if (m_iRepCountCurent <= 1)
100 m_iRepCountCurent = GetRepCount();
101 m_fTriggerTime = GetSequenceRepTime();
106 m_fTriggerTime = GetRepTime();
117 m_iRepCountCurent = GetRepCount();
118 m_fTriggerTime = GetSequenceRepTime();
122 void SCR_TriggerSoundComponent(IEntityComponentSource src,
IEntity ent,
IEntity parent)
124 SetScriptedMethodsCall(
true);
128 void ~SCR_TriggerSoundComponent()
bool IsInRange(notnull IEntity actionOwner, vector actionPosition)
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
enum EVehicleType IEntity
proto external BaseWorld GetWorld()
proto external void GetTransform(out vector mat[])
void OnUpdateSoundJobBegin(IEntity owner)
void UpdateSoundJob(IEntity owner, float timeSlice)
Call when component is in range.
SCR_FieldOfViewSettings Attribute