13 class SCR_AmbientInsectsComponentClass : ScriptComponentClass
20 [
Attribute(defvalue:
"4", UIWidgets.Slider,
params:
"0 60 1",
desc:
"How frequently are Insects updated around the camera")]
21 protected int m_iUpdateRate;
24 protected ref array<ref SCR_AmbientInsectsEffect> m_aAmbientInsectsEffect;
27 protected SignalsManagerComponent m_LocalSignalsManager;
32 protected int m_iEnvironmentTypeSignalValue;
35 protected ref array<int> m_aLocalAmbientSignalIndex = {};
37 protected float m_fTimeOfDay;
38 protected float m_fRainIntensity;
39 protected float m_fWindSpeed;
41 protected int m_iSunAngleSignalIdx;
42 protected int m_iRainIntensitySignalIdx;
43 protected int m_iWindSpeedSignalIdx;
47 int GetEnvironmentType()
49 return m_iEnvironmentTypeSignalValue;
61 float GetRainIntensity()
63 return m_fRainIntensity;
78 m_aAmbientInsectsEffect.RemoveItem(effect);
82 protected void Update(IEntity owner)
84 float worldTime = owner.GetWorld().GetWorldTime();
93 m_fRainIntensity = m_GlobalSignalsManager.GetSignalValue(m_iRainIntensitySignalIdx);
94 m_fWindSpeed = m_GlobalSignalsManager.GetSignalValue(m_iWindSpeedSignalIdx);
97 for (
int i = m_aAmbientInsectsEffect.Count() - 1; i >= 0; i--)
99 if (m_aAmbientInsectsEffect.IsIndexValid(i))
100 m_aAmbientInsectsEffect[i].Update(worldTime, cameraPos, m_fTimeOfDay, m_fRainIntensity);
105 override void OnPostInit(IEntity owner)
107 super.OnPostInit(owner);
109 if (RplSession.Mode() == RplMode.Dedicated)
116 Print(
"AMBIENT LIFE: SCR_AmbientInsectsComponent: Missing SignalsManagerComponent", LogLevel.WARNING);
120 m_GlobalSignalsManager =
GetGame().GetSignalsManager();
124 int size = enumType.GetVariableCount();
126 for (
int i = 0; i < size; i++)
132 m_iRainIntensitySignalIdx = m_GlobalSignalsManager.AddOrFindSignal(
"RainIntensity");
133 m_iWindSpeedSignalIdx = m_GlobalSignalsManager.AddOrFindSignal(
"WindSpeed");
138 Print(
"AMBIENT LIFE: SCR_AmbientInsectsComponent: Missing SCR_AmbientSoundsComponent", LogLevel.WARNING);
159 DiagMenu.RegisterBool(
SCR_DebugMenuID.DEBUGUI_AMBIENT_LIFE,
"",
"Ambient Life",
"World");