Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс EntityLightSource

Закрытые члены

void ScriptedLightBase ()
 Constructor. Everything here is executed before the constructor of all children.
 
void ~ScriptedLightBase ()
 
override void EOnInit (IEntity other, int extra)
 
override bool IsScriptedLight ()
 
void UpdateMode ()
 
void UpdateLightMode (string slotName)
 
void DeleteLightWithDelay ()
 Correct way of deleting light from memory. It is necesarry to have this delay due to hierarchy.
 
void DeleteLightNow ()
 
void AttachOnObject (Object parent, vector local_pos="0 0 0", vector local_ori="0 0 0")
 Attaches this light on the parent entity, with optional position and orientation offset.
 
Object GetAttachmentParent ()
 Returns attachment parent.
 
void AttachOnMemoryPoint (Object parent, string memory_point_start, string memory_point_target="")
 Attaches this light on the parent entity's memory point, with optional direction target memory point.
 
void DetachFromParent ()
 Detaches this light from its parent entity.
 
void SetBrightnessTo (float value)
 Sets the brightness of the light.
 
void CorrectLightPulseDuringDaylight ()
 Call this after using SetBrightness(...) to fix light's intensity during daytime.
 
void FadeBrightnessTo (float value, float time_in_s)
 Fades the brightness of the light to the given value.
 
void SetRadiusTo (float value)
 Sets the radius of the light.
 
void FadeRadiusTo (float value, float time_in_s)
 Fades the radius of the light to the given value.
 
void Destroy ()
 Switches off the light and deletes it from memory.
 
void SetLifetime (float life_in_s)
 Makes the light destroy itself after the given time in seconds. The light will fade out if it's set to do so with SetFadeOutTime(...)
 
void SetFadeOutTime (float time_in_s)
 Sets the fade out time in seconds. Fade out begins automatically as the light nears the end of its life time, or when method FadeOut() is called.
 
void FadeOut (float time_in_s=-1)
 Starts the fade out process and destroys the light when its done. Optional parameter allows you to set time of this fade out in seconds. If not set, then default value (from SetFadeOutTime(...)) is used.
 
void FadeIn (float time_in_s)
 Makes the light fade into existence. Works only at the moment the light is created. Consider using FadeBrightnessTo(...) and FadeRadiusTo(...) at anytime later during lifetime.
 
void AddLifetime (float life_in_s)
 Prolongs the lifetime of the light in seconds. Use negative number to shorten its lifetime.
 
void OnFrameLightSource (IEntity other, float timeSlice)
 Override this for custom functionality.
 
override void EOnFrame (IEntity other, float timeSlice)
 On frame event. If you want to control your light within your own rules then override the event OnFrameLightSource and put your code there.
 
void SetDancingShadowsAmplitude (float max_deviation_in_meters)
 Sets the maximum range of the point light within the dancing shadows effect.
 
void SetDancingShadowsMovementSpeed (float speed_in_meters_per_frame)
 Sets the maximum speed of the point light within the dancing shadows effect.
 
float GetDancingShadowsAmplitude ()
 Returns max movement range of pointlight within the dancing shadow effect.
 
float GetDancingShadowsMovementSpeed ()
 Returns max movement speed of pointlight within the dancing shadow effect.
 
void EnableDebug (bool state)
 Enables some debug functionality of this light.
 
void HandleDancingShadows (float time, float timeSlice)
 
void HandleFlickering (float time, float timeSlice)
 
void SetFlickerSpeed (float speed)
 Sets speed of light flickering (random brightness coefficient change per second)
 
void SetFlickerAmplitude (float coef)
 Sets the change coefficient of flickering light. (0.0 - 1.0 values, result of greater values are period time of light off )
 
void SetFlickerAmplitudeMax (float coef)
 
void SetFlickerAmplitudeMin (float coef)
 
float GetFlickerSpeed ()
 Returns flicker speed.
 
float GetFlickerAmplitudeCoefMax ()
 Returns flicker amplitude maximum.
 
float GetFlickerAmplitudeCoefMin ()
 Returns flicker amplitude minimum.
 
void TryShadowOptimization ()
 Optimizes shadows by disabling them on this light source while it's within the given radius around the camera.
 
void SetDisableShadowsWithinRadius (float radius_in_m)
 When the light source gets within this radius (radius_in_m) around the camera, then it's shadows are disabled.
 
float GetDisableShadowsWithinRadius ()
 Returns the range you put inside SetDisableShadowsWithinRadius(...)
 
void CheckIfParentIsInCargo ()
 
bool CheckLifetime (int current_time)
 
void CheckFadeOut (int current_time)
 
void HandleBrightnessFadeing (float timeSlice)
 
void HandleRadiusFadeing (float timeSlice)
 
void SetBlinkingSpeed (float _speed)
 Sets blinking speed (no blinking if speed <= 0)
 
float GetBlinkingSpeed ()
 Returns the speed of blinks.
 
void HandleBlinking (float time)
 

Закрытые статические члены

static ScriptedLightBase CreateLightAtObjMemoryPoint (typename name, notnull Object target, string memory_point_start, string memory_point_target="", vector global_pos="0 0 0", float fade_in_time_in_s=0)
 
static ScriptedLightBase CreateLight (typename name, vector global_pos="0 0 0", float fade_in_time_in_s=0)
 Creates an instance of light on the given position. Optionally, use fade_in_time_in_s parameter to make the light fade into existence.
 

Закрытые данные

float m_LifetimeStart
 
float m_LifetimeEnd = -1
 
float m_FadeOutTime = -1
 
float m_FadeInTime = -1
 
float m_Radius
 
float m_RadiusTarget
 
float m_Brightness
 
float m_BrightnessPulse
 
float m_BrightnessPulseSpeed
 
float m_BrightnessPulseAmplitudeMax
 
float m_BrightnessPulseAmplitudeMin
 
float m_BrightnessTarget
 
float m_BrightnessSpeedOfChange = 1
 
float m_RadiusSpeedOfChange = 1
 
float m_OptimizeShadowsRadius = 0
 
float m_DancingShadowsAmplitude
 
float m_DancingShadowsSpeed
 
float m_BlinkingSpeed
 
bool m_IsDebugEnabled = false
 
Object m_Parent
 
vector m_LocalPos
 
vector m_LocalOri
 
vector m_DancingShadowsLocalPos
 
ref Timer m_DeleteTimer
 

Закрытые статические данные

static ref set< ScriptedLightBasem_NightTimeOnlyLights = new set<ScriptedLightBase>()
 

Подробное описание

Конструктор(ы)

◆ ~ScriptedLightBase()

void ~ScriptedLightBase ( )
inlineprivate
54 {
56 {
57 int index = m_NightTimeOnlyLights.Find(this);
58 if (index != -1)
59 {
61 }
62 }
63 }
static ref set< ScriptedLightBase > m_NightTimeOnlyLights
Definition ScriptedLightBase.c:42
Definition EntityAI.c:95

Методы

◆ AddLifetime()

void AddLifetime ( float life_in_s)
inlineprivate

Prolongs the lifetime of the light in seconds. Use negative number to shorten its lifetime.

375 {
376 m_LifetimeEnd += life_in_s * 1000;
377 }
float m_LifetimeEnd
Definition ScriptedLightBase.c:13

◆ AttachOnMemoryPoint()

void AttachOnMemoryPoint ( Object parent,
string memory_point_start,
string memory_point_target = "" )
inlineprivate

Attaches this light on the parent entity's memory point, with optional direction target memory point.

161 {
162 if (parent.MemoryPointExists(memory_point_start))
163 {
164 m_LocalPos = parent.GetMemoryPointPos(memory_point_start);
166
167 if (memory_point_target != "" )
168 {
169 if (parent.MemoryPointExists(memory_point_target))
170 {
171 vector target_pos = parent.GetSelectionPositionLS(memory_point_target);
173 local_ori = target_pos.VectorToAngles();
174 }
175 else
176 {
177 ErrorEx("memory point 'memory_point_target' not found when attaching light");
178 }
179 }
181 UpdateMode();
182 }
183 else
184 {
185 ErrorEx("memory point 'memory_point_start' not found when attaching light");
186 }
187 }
void AttachOnObject(Object parent, vector local_pos="0 0 0", vector local_ori="0 0 0")
Attaches this light on the parent entity, with optional position and orientation offset.
Definition ScriptedLightBase.c:125
void UpdateMode()
Definition ScriptedLightBase.c:81
vector m_LocalPos
Definition ScriptedLightBase.c:36
Definition EnConvert.c:106
static vector Direction(vector p1, vector p2)
Returns direction vector from point p1 to point p2.
Definition EnConvert.c:220
enum ShapeType ErrorEx

Перекрестные ссылки vector::Direction(), ErrorEx и m_LocalPos.

◆ AttachOnObject()

void AttachOnObject ( Object parent,
vector local_pos = "0 0 0",
vector local_ori = "0 0 0" )
inlineprivate

Attaches this light on the parent entity, with optional position and orientation offset.

126 {
127 if (!parent)
128 {
129 if (m_Parent)
130 {
131 m_Parent.RemoveChild(this);
132 }
133
134 return;
135 }
136 else
137 {
138 if (m_Parent)
139 {
140 m_Parent.RemoveChild(this);
141 }
142 }
143
144 m_Parent = parent;
147 SetOrientation(local_ori);
149 parent.AddChild(this, -1);
150 parent.Update();
151 }
Object m_Parent
Definition ScriptedLightBase.c:35
vector m_LocalOri
Definition ScriptedLightBase.c:37
proto native void SetPosition(vector position)
Set the world position of the Effect.
Definition Effect.c:436

Перекрестные ссылки m_LocalOri, m_LocalPos, m_Parent и SetPosition().

◆ CheckFadeOut()

void CheckFadeOut ( int current_time)
inlineprivate
627 {
628 // Control fade out of the light
630 {
631 m_FadeOutTime = -1;
632 m_FadeInTime = -1; // Stop fade in process
633 float time_left_in_s = (m_LifetimeEnd - current_time) * 0.001;
636 }
637 }
float m_FadeOutTime
Definition ScriptedLightBase.c:14
void FadeBrightnessTo(float value, float time_in_s)
Fades the brightness of the light to the given value.
Definition ScriptedLightBase.c:283
float m_FadeInTime
Definition ScriptedLightBase.c:15
void FadeRadiusTo(float value, float time_in_s)
Fades the radius of the light to the given value.
Definition ScriptedLightBase.c:306

◆ CheckIfParentIsInCargo()

void CheckIfParentIsInCargo ( )
inlineprivate
575 {
576 // TO DO: OPTIMIZE AND REFACTOR! THIS MUST BE HANDLED IN AN EVENT, NOT PER FRAME!
577
578 if (m_Parent)
579 {
581
582 if (parent_EAI) // Check if the Cast was successfull
583 {
584 GameInventory GI = parent_EAI.GetInventory();
585
586 if (GI) // Prevents handling of light on the parent item when it's projected in inventory as the item in inventory character's hands.
587 {
588 bool is_in_cargo = GI.IsInCargo();
589
590 if (!is_in_cargo)
591 {
592 EntityAI parent2 = parent_EAI.GetHierarchyParent();
593
594 if (parent2 && parent2.GetInventory())
595 {
596 is_in_cargo = parent2.GetInventory().IsInCargo();
597 }
598 }
599
600 if ( is_in_cargo )
601 {
602 SetEnabled(false);
603 }
604 else
605 {
606 SetEnabled(true);
607 }
608 }
609 }
610 }
611 }
void SetEnabled()
prevents insider adding in the wrong position, HOTFIX
Definition TrapTrigger.c:119
Definition Building.c:6
script counterpart to engine's class Inventory
Definition Inventory.c:79

Перекрестные ссылки m_Parent и SetEnabled().

◆ CheckLifetime()

bool CheckLifetime ( int current_time)
inlineprivate
615 {
617 {
618 Destroy();
619 return false;
620 }
621
622 return true;
623 }
void Destroy()
Switches off the light and deletes it from memory.
Definition ScriptedLightBase.c:321

Перекрестные ссылки Destroy().

◆ CorrectLightPulseDuringDaylight()

void CorrectLightPulseDuringDaylight ( )
inlineprivate

Call this after using SetBrightness(...) to fix light's intensity during daytime.

263 {
264 if (m_Brightness < 100)
265 {
266 float v = m_Brightness * 0.01;
267
268 if (v > 0)
269 {
270 float brightness_compesation = 1 / v;
272 SetBrightness(compenset_brightness);
273 SetPulseCoef(v);
274 }
275 }
276 else
277 {
278 SetPulseCoef(1);
279 }
280 }
float m_BrightnessPulse
Definition ScriptedLightBase.c:19
float m_Brightness
Definition ScriptedLightBase.c:18

◆ CreateLight()

static ScriptedLightBase CreateLight ( typename name ,
vector global_pos = "0 0 0",
float fade_in_time_in_s = 0 )
inlinestaticprivate

Creates an instance of light on the given position. Optionally, use fade_in_time_in_s parameter to make the light fade into existence.

223 {
225
226 if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() ) // Client side
227 {
228 light_instance = ScriptedLightBase.Cast( GetGame().CreateObject(name.ToString(), global_pos, true) );
229
230 if (!light_instance)
231 {
232 Error("Error! Light entity of name " + name.ToString() + " cannot be spawned! This name is incorrect or not inherited from ScriptedLightBase." );
233 return null;
234 }
235
236 if (fade_in_time_in_s != 0)
237 {
239 }
240 }
241 else // Server side
242 {
243 if ( GetGame().IsDebug() )
244 {
245 Error("An instance of ScriptedLightBase was attempted to spawn on server side! Lights are CLIENT SIDE ONLY!");
246 }
247 }
248
249 return light_instance;
250 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Definition PointLightBase.c:2
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

Перекрестные ссылки Error(), GetGame() и name.

◆ CreateLightAtObjMemoryPoint()

static ScriptedLightBase CreateLightAtObjMemoryPoint ( typename name ,
notnull Object target,
string memory_point_start,
string memory_point_target = "",
vector global_pos = "0 0 0",
float fade_in_time_in_s = 0 )
inlinestaticprivate
211 {
213 if (target.MemoryPointExists(memory_point_start))
214 {
216 light.AttachOnMemoryPoint(target, memory_point_start, memory_point_target);
217 }
218 return light;
219 }
void CreateLight()
Definition ExplosivesBase.c:145

Перекрестные ссылки CreateLight() и name.

◆ DeleteLightNow()

void DeleteLightNow ( )
inlineprivate
120 {
121 GetGame().ObjectDelete(this);
122 }

Перекрестные ссылки GetGame().

◆ DeleteLightWithDelay()

void DeleteLightWithDelay ( )
inlineprivate

Correct way of deleting light from memory. It is necesarry to have this delay due to hierarchy.

105 {
106 DetachFromParent(); // This is the reason for the delay
107
108 if (GetGame())
109 {
110 if (!m_DeleteTimer)
112
113 m_DeleteTimer.Run( 0.03 , this, "DeleteLightNow", NULL, true);
114 }
115
116 }
void DetachFromParent()
Detaches this light from its parent entity.
Definition ScriptedLightBase.c:190
ref Timer m_DeleteTimer
Definition ScriptedLightBase.c:40
Definition DayZPlayerImplement.c:63
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8

Перекрестные ссылки CALL_CATEGORY_SYSTEM, GetGame() и m_DeleteTimer.

◆ Destroy()

void Destroy ( )
inlineprivate

Switches off the light and deletes it from memory.

322 {
323 ClearEventMask(EntityEvent.FRAME);
324 SetEnabled(false);
325 if (m_Parent)
327 else
329 }
void DeleteLightNow()
Definition ScriptedLightBase.c:119
void DeleteLightWithDelay()
Correct way of deleting light from memory. It is necesarry to have this delay due to hierarchy.
Definition ScriptedLightBase.c:104
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition EnEntity.c:45

Перекрестные ссылки m_Parent и SetEnabled().

◆ DetachFromParent()

void DetachFromParent ( )
inlineprivate

Detaches this light from its parent entity.

191 {
192 if (!m_Parent)
193 {
194 m_Parent = Object.Cast( GetParent() );
195 }
196
197 if (m_Parent)
198 {
199 if ( !m_Parent.ToDelete() && !ToDelete() )
200 {
201 m_Parent.RemoveChild(this);
202 }
203 }
204
205 m_Parent = null;
206 m_LocalPos = Vector(0,0,0);
207 m_LocalOri = Vector(0,0,0);
208 }
Definition ObjectTyped.c:2
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
proto native Widget GetParent()
Get parent of the Effect.
Definition Effect.c:405

Перекрестные ссылки GetParent(), m_LocalOri, m_LocalPos, m_Parent и Vector().

◆ EnableDebug()

void EnableDebug ( bool state)
inlineprivate

Enables some debug functionality of this light.

439 {
441 }
bool m_IsDebugEnabled
Definition ScriptedLightBase.c:33

◆ EOnFrame()

override void EOnFrame ( IEntity other,
float timeSlice )
inlineprivate

On frame event. If you want to control your light within your own rules then override the event OnFrameLightSource and put your code there.

387 {
388 // Control lifetime of the light
389 int current_time = GetGame().GetTime();
390
392 {
393 SetRadius(m_Radius);
394 }
395 else
396 {
397 return;
398 }
399
405
409
411 }
bool CheckLifetime(int current_time)
Definition ScriptedLightBase.c:614
void CheckIfParentIsInCargo()
Definition ScriptedLightBase.c:574
float m_LifetimeStart
Definition ScriptedLightBase.c:12
void HandleBlinking(float time)
Definition ScriptedLightBase.c:716
void HandleRadiusFadeing(float timeSlice)
Definition ScriptedLightBase.c:673
void HandleBrightnessFadeing(float timeSlice)
Definition ScriptedLightBase.c:640
void HandleFlickering(float time, float timeSlice)
Definition ScriptedLightBase.c:484
void HandleDancingShadows(float time, float timeSlice)
Definition ScriptedLightBase.c:444
float m_Radius
Definition ScriptedLightBase.c:16
void OnFrameLightSource(IEntity other, float timeSlice)
Override this for custom functionality.
Definition ScriptedLightBase.c:380
void CheckFadeOut(int current_time)
Definition ScriptedLightBase.c:626
void TryShadowOptimization()
Optimizes shadows by disabling them on this light source while it's within the given radius around th...
Definition ScriptedLightBase.c:545

Перекрестные ссылки GetGame() и m_Radius.

◆ EOnInit()

override void EOnInit ( IEntity other,
int extra )
inlineprivate
66 {
67 if (!IsVisibleDuringDaylight())
68 {
70 if (player && player.m_UndergroundPresence)
71 SetVisibleDuringDaylight(true);
72 m_NightTimeOnlyLights.Insert(this);
73 }
74 }
PlayerBase GetPlayer()
Definition ModifierBase.c:47
Definition PlayerBaseClient.c:2

Перекрестные ссылки GetGame() и GetPlayer().

◆ FadeBrightnessTo()

void FadeBrightnessTo ( float value,
float time_in_s )
inlineprivate

Fades the brightness of the light to the given value.

284 {
286
287 if (time_in_s == 0)
288 {
290 }
291 else
292 {
294 }
295 }
float m_BrightnessSpeedOfChange
Definition ScriptedLightBase.c:24
float m_BrightnessTarget
Definition ScriptedLightBase.c:23
Definition EnMath.c:7
static proto float AbsFloat(float f)
Returns absolute value.

Перекрестные ссылки Math::AbsFloat().

◆ FadeIn()

void FadeIn ( float time_in_s)
inlineprivate

Makes the light fade into existence. Works only at the moment the light is created. Consider using FadeBrightnessTo(...) and FadeRadiusTo(...) at anytime later during lifetime.

367 {
368 float brightness = m_Brightness;
371 }
void SetBrightnessTo(float value)
Sets the brightness of the light.
Definition ScriptedLightBase.c:253

◆ FadeOut()

void FadeOut ( float time_in_s = -1)
inlineprivate

Starts the fade out process and destroys the light when its done. Optional parameter allows you to set time of this fade out in seconds. If not set, then default value (from SetFadeOutTime(...)) is used.

346 {
347 float time_in_ms = time_in_s * 1000;
348
349 if (time_in_s == -1)
350 {
351 float kill_time_in_s = m_FadeOutTime*0.001;
352
356 }
357 else
358 {
362 }
363 }
void SetLifetime(float life_in_s)
Makes the light destroy itself after the given time in seconds. The light will fade out if it's set t...
Definition ScriptedLightBase.c:332

◆ FadeRadiusTo()

void FadeRadiusTo ( float value,
float time_in_s )
inlineprivate

Fades the radius of the light to the given value.

307 {
309
310 if (time_in_s == 0)
311 {
313 }
314 else
315 {
317 }
318 }
float m_RadiusSpeedOfChange
Definition ScriptedLightBase.c:25
float m_RadiusTarget
Definition ScriptedLightBase.c:17

Перекрестные ссылки Math::AbsFloat() и m_Radius.

◆ GetAttachmentParent()

Object GetAttachmentParent ( )
inlineprivate

Returns attachment parent.

155 {
156 return m_Parent;
157 }

Перекрестные ссылки m_Parent.

◆ GetBlinkingSpeed()

float GetBlinkingSpeed ( )
inlineprivate

Returns the speed of blinks.

711 {
712 return m_BlinkingSpeed;
713 }
float m_BlinkingSpeed
Definition ScriptedLightBase.c:31

◆ GetDancingShadowsAmplitude()

float GetDancingShadowsAmplitude ( )
inlineprivate

Returns max movement range of pointlight within the dancing shadow effect.

427 {
429 }
float m_DancingShadowsAmplitude
Definition ScriptedLightBase.c:28

◆ GetDancingShadowsMovementSpeed()

float GetDancingShadowsMovementSpeed ( )
inlineprivate

Returns max movement speed of pointlight within the dancing shadow effect.

433 {
435 }
float m_DancingShadowsSpeed
Definition ScriptedLightBase.c:29

◆ GetDisableShadowsWithinRadius()

float GetDisableShadowsWithinRadius ( )
inlineprivate

Returns the range you put inside SetDisableShadowsWithinRadius(...)

570 {
572 }
float m_OptimizeShadowsRadius
Definition ScriptedLightBase.c:26

◆ GetFlickerAmplitudeCoefMax()

float GetFlickerAmplitudeCoefMax ( )
inlineprivate

Returns flicker amplitude maximum.

534 {
536 }
float m_BrightnessPulseAmplitudeMax
Definition ScriptedLightBase.c:21

◆ GetFlickerAmplitudeCoefMin()

float GetFlickerAmplitudeCoefMin ( )
inlineprivate

Returns flicker amplitude minimum.

540 {
542 }
float m_BrightnessPulseAmplitudeMin
Definition ScriptedLightBase.c:22

◆ GetFlickerSpeed()

float GetFlickerSpeed ( )
inlineprivate

Returns flicker speed.

528 {
530 }
float m_BrightnessPulseSpeed
Definition ScriptedLightBase.c:20

◆ HandleBlinking()

void HandleBlinking ( float time)
inlineprivate
717 {
718 if ( m_BlinkingSpeed <= 0 )
719 return;
720
721 float multiplier;
722
723 multiplier = Math.Sin(time * 0.001 * m_BlinkingSpeed); // Oscillate the multiplier overtime (time normalized to sec)
724 multiplier = (multiplier + 1)/2; // Normalized the value to 0-1
725
726 multiplier = Math.Round(multiplier); // Rounding to 0 or 1 to make it blink instantly
727 SetBrightness(m_Brightness * multiplier);
728 }
static proto float Round(float f)
Returns mathematical round of value.
static proto float Sin(float angle)
Returns sinus of angle in radians.

Перекрестные ссылки Math::Round() и Math::Sin().

◆ HandleBrightnessFadeing()

void HandleBrightnessFadeing ( float timeSlice)
inlineprivate
641 {
643 {
645
648
651
653
654 if ( m_Brightness > 0 || m_BrightnessTarget > 0)
655 {
656 SetBrightness(m_Brightness * m_BrightnessPulse);
658 }
659 else
660 {
661 Destroy();
662 return;
663 }
664 }
665 else
666 {
667 SetBrightness(m_Brightness * m_BrightnessPulse);
669 }
670 }
void CorrectLightPulseDuringDaylight()
Call this after using SetBrightness(...) to fix light's intensity during daytime.
Definition ScriptedLightBase.c:262

Перекрестные ссылки Destroy().

◆ HandleDancingShadows()

void HandleDancingShadows ( float time,
float timeSlice )
inlineprivate
445 {
447 {
448 for (int i = 0; i < 3; i++ )
449 {
451
454
457
458 }
459
460 if (m_Parent && !m_Parent.ToDelete())
461 {
462 // In order to move with the light, it must be detached from its parent first
463
464 m_Parent.RemoveChild(this);
466
467 m_Parent.AddChild(this, -1);
468 m_Parent.Update();
469 }
470
472 {
473 Particle p = ParticleManager.GetInstance().PlayInWorld( ParticleList.DEBUG_DOT, GetPosition() );
474 p.SetParticleParam( EmitorParam.SIZE, 0.01);
475 }
476 }
477 else
478 {
480 }
481 }
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Definition ParticleManager.c:84
class JsonUndergroundAreaTriggerData GetPosition
Definition UndergroundAreaLoader.c:9
vector m_DancingShadowsLocalPos
Definition ScriptedLightBase.c:38
Legacy way of using particles in the game.
Definition Particle.c:7
Definition ParticleList.c:12
static const int DEBUG_DOT
Definition ParticleList.c:23
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
EmitorParam
Definition EnVisual.c:114

Перекрестные ссылки ParticleList::DEBUG_DOT, GetPosition, m_LocalPos, m_Parent, ParticleManager(), Math::RandomFloat(), SetPosition() и Vector().

◆ HandleFlickering()

void HandleFlickering ( float time,
float timeSlice )
inlineprivate

◆ HandleRadiusFadeing()

void HandleRadiusFadeing ( float timeSlice)
inlineprivate
674 {
675 if ( m_Radius != m_RadiusTarget )
676 {
678
681
684
686
687 if ( m_Radius > 0 || m_RadiusTarget > 0)
688 {
689 SetRadius(m_Radius);
690 }
691 else
692 {
693 Destroy();
694 return;
695 }
696 }
697 else
698 {
699 SetRadius(m_Radius);
700 }
701 }

Перекрестные ссылки Destroy() и m_Radius.

◆ IsScriptedLight()

override bool IsScriptedLight ( )
inlineprivate
77 {
78 return true;
79 }

◆ OnFrameLightSource()

void OnFrameLightSource ( IEntity other,
float timeSlice )
inlineprivate

Override this for custom functionality.

381 {
382 // ...
383 }

◆ ScriptedLightBase()

void ScriptedLightBase ( )
inlineprivate

Constructor. Everything here is executed before the constructor of all children.

46 {
47 m_LifetimeStart = GetGame().GetTime();
48 SetEnabled(true);
49 SetEventMask(EntityEvent.FRAME);
50 SetEventMask(EntityEvent.INIT);
51 }

Перекрестные ссылки GetGame() и SetEnabled().

◆ SetBlinkingSpeed()

void SetBlinkingSpeed ( float _speed)
inlineprivate

Sets blinking speed (no blinking if speed <= 0)

705 {
707 }

◆ SetBrightnessTo()

void SetBrightnessTo ( float value)
inlineprivate

Sets the brightness of the light.

◆ SetDancingShadowsAmplitude()

void SetDancingShadowsAmplitude ( float max_deviation_in_meters)
inlineprivate

Sets the maximum range of the point light within the dancing shadows effect.

Перекрестные ссылки Math::AbsFloat().

◆ SetDancingShadowsMovementSpeed()

void SetDancingShadowsMovementSpeed ( float speed_in_meters_per_frame)
inlineprivate

Sets the maximum speed of the point light within the dancing shadows effect.

Перекрестные ссылки Math::AbsFloat().

◆ SetDisableShadowsWithinRadius()

void SetDisableShadowsWithinRadius ( float radius_in_m)
inlineprivate

When the light source gets within this radius (radius_in_m) around the camera, then it's shadows are disabled.

◆ SetFadeOutTime()

void SetFadeOutTime ( float time_in_s)
inlineprivate

Sets the fade out time in seconds. Fade out begins automatically as the light nears the end of its life time, or when method FadeOut() is called.

340 {
341 m_FadeOutTime = time_in_s * 1000;
342 }

◆ SetFlickerAmplitude()

void SetFlickerAmplitude ( float coef)
inlineprivate

Sets the change coefficient of flickering light. (0.0 - 1.0 values, result of greater values are period time of light off )

Перекрестные ссылки Math::AbsFloat().

◆ SetFlickerAmplitudeMax()

void SetFlickerAmplitudeMax ( float coef)
inlineprivate
517 {
519 }

◆ SetFlickerAmplitudeMin()

void SetFlickerAmplitudeMin ( float coef)
inlineprivate
522 {
524 }

◆ SetFlickerSpeed()

void SetFlickerSpeed ( float speed)
inlineprivate

Sets speed of light flickering (random brightness coefficient change per second)

505 {
507 }

◆ SetLifetime()

void SetLifetime ( float life_in_s)
inlineprivate

Makes the light destroy itself after the given time in seconds. The light will fade out if it's set to do so with SetFadeOutTime(...)

333 {
334 if(GetGame())
335 m_LifetimeEnd = GetGame().GetTime() + life_in_s * 1000;
336 }

Перекрестные ссылки GetGame().

◆ SetRadiusTo()

void SetRadiusTo ( float value)
inlineprivate

Sets the radius of the light.

299 {
300 m_Radius = value;
302 SetRadius(m_Radius);
303 }

Перекрестные ссылки m_Radius.

◆ TryShadowOptimization()

void TryShadowOptimization ( )
inlineprivate

Optimizes shadows by disabling them on this light source while it's within the given radius around the camera.

546 {
548 {
549 float distance_to_camera = vector.Distance( GetPosition(), GetGame().GetCurrentCameraPosition() );
550
552 {
553 SetCastShadow(false);
554 }
555 else
556 {
557 SetCastShadow(true);
558 }
559 }
560 }
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.

Перекрестные ссылки vector::Distance(), GetGame() и GetPosition.

◆ UpdateLightMode()

void UpdateLightMode ( string slotName)
private

◆ UpdateMode()

void UpdateMode ( )
inlineprivate
82 {
84 if (item)
85 {
87 item.GetInventory().GetCurrentInventoryLocation( il );
88 string slotName;
89 if (il.GetType() == InventoryLocationType.GROUND)
90 {
91 slotName = "Ground";
92 }
93 else if (il.GetSlot() != -1)
94 {
96 }
98 }
99 }
PlayerSpawnPreset slotName
InventoryLocationType
types of Inventory Location
Definition InventoryLocation.c:4
void UpdateLightMode(string slotName)
InventoryLocation.
Definition InventoryLocation.c:28
provides access to slot configuration
Definition InventorySlots.c:6
static proto native owned string GetSlotName(int id)
converts slot_id to string
Definition InventoryItem.c:731

Перекрестные ссылки InventorySlots::GetSlotName(), m_Parent и slotName.

Поля

◆ m_BlinkingSpeed

float m_BlinkingSpeed
private

◆ m_Brightness

float m_Brightness
private

◆ m_BrightnessPulse

float m_BrightnessPulse
private

◆ m_BrightnessPulseAmplitudeMax

float m_BrightnessPulseAmplitudeMax
private

◆ m_BrightnessPulseAmplitudeMin

float m_BrightnessPulseAmplitudeMin
private

◆ m_BrightnessPulseSpeed

float m_BrightnessPulseSpeed
private

◆ m_BrightnessSpeedOfChange

float m_BrightnessSpeedOfChange = 1
private

◆ m_BrightnessTarget

float m_BrightnessTarget
private

◆ m_DancingShadowsAmplitude

float m_DancingShadowsAmplitude
private

◆ m_DancingShadowsLocalPos

vector m_DancingShadowsLocalPos
private

◆ m_DancingShadowsSpeed

float m_DancingShadowsSpeed
private

◆ m_DeleteTimer

ref Timer m_DeleteTimer
private

◆ m_FadeInTime

float m_FadeInTime = -1
private

◆ m_FadeOutTime

float m_FadeOutTime = -1
private

◆ m_IsDebugEnabled

bool m_IsDebugEnabled = false
private

◆ m_LifetimeEnd

float m_LifetimeEnd = -1
private

◆ m_LifetimeStart

float m_LifetimeStart
private

◆ m_LocalOri

vector m_LocalOri
private

◆ m_LocalPos

vector m_LocalPos
private

◆ m_NightTimeOnlyLights

ref set<ScriptedLightBase> m_NightTimeOnlyLights = new set<ScriptedLightBase>()
staticprivate

◆ m_OptimizeShadowsRadius

float m_OptimizeShadowsRadius = 0
private

◆ m_Parent

Object m_Parent
private

◆ m_Radius

float m_Radius
private

◆ m_RadiusSpeedOfChange

float m_RadiusSpeedOfChange = 1
private

◆ m_RadiusTarget

float m_RadiusTarget
private

Объявления и описания членов класса находятся в файле: