DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ContaminatedArea_DynamicBase.c
См. документацию.
2{
3 INIT = 1, // The dynamic area is initializing
4 START = 2, // The dynamic area is starting
5 LIVE = 3, // The dynamic area is live
6 DECAY_START = 4, // The dynamic area decay has started
7 DECAY_END = 5, // The dynamic area will soon be deleted
8}
9
11{
12 protected int m_DecayState = eAreaDecayStage.INIT; // The current state in which the area is
13
14 // Constants used for dissapearing events
15 const float DECAY_START_PART_SIZE = 32;
17 const float DECAY_END_PART_SIZE = 17;
19 const float START_DECAY_LIFETIME = 900;
20 const float FINISH_DECAY_LIFETIME = 300;
21
23 {
24 m_Type = eZoneType.DYNAMIC;
25
26 RegisterNetSyncVariableInt("m_DecayState");
27 }
28
29
31 {
32 return GetLifetime();
33 }
34
36 {
38 }
39
41 {
43 }
44
45 // Set the new state of the Area
46 void SetDecayState(int newState)
47 {
48 if (m_DecayState != newState)
49 {
50 m_DecayState = newState;
51
52 // We update the trigger state values as we also want to update player bound effects
53 if ( m_Trigger )
54 ContaminatedTrigger_Dynamic.Cast( m_Trigger ).SetAreaState( m_DecayState );
55
56 SetSynchDirty();
57 }
58 }
59
60 // We spawn particles and setup trigger
61 override void InitZone()
62 {
64
65 super.InitZone();
66 }
67
68 override void InitZoneClient()
69 {
70 super.InitZoneClient();
71
72 #ifndef NO_GUI
73 // We spawn VFX on client
74 PlaceParticles(m_Position, m_Radius, m_InnerRings, m_InnerSpacing, m_OuterRingToggle, m_OuterSpacing, m_OuterRingOffset, m_ParticleID);
75 #endif
76 }
77
78 override void InitZoneServer()
79 {
80 super.InitZoneServer();
81
82 // We create the trigger on server
83 if (m_TriggerType != "")
84 CreateTrigger(m_PositionTrigger, m_Radius);
85 }
86
88 {
89 super.OnParticleAllocation(pm, particles);
90
92 {
93 foreach (ParticleSource p : particles)
94 {
95 if (m_DecayState == eAreaDecayStage.DECAY_END)
96 {
97 p.SetParameter(0, EmitorParam.BIRTH_RATE, DECAY_END_PART_BIRTH_RATE);
98 p.SetParameter(0, EmitorParam.SIZE, DECAY_END_PART_SIZE);
99 }
100 else
101 {
102 p.SetParameter(0, EmitorParam.BIRTH_RATE, DECAY_START_PART_BIRTH_RATE);
103 p.SetParameter(0, EmitorParam.SIZE, DECAY_START_PART_SIZE);
104 }
105 }
106 }
107 }
108
109 override void CreateTrigger(vector pos, int radius)
110 {
111 super.CreateTrigger(pos, radius);
112
113 // This handles the specific case of dynamic triggers as some additionnal parameters are present
114 ContaminatedTrigger_Dynamic dynaTrigger = ContaminatedTrigger_Dynamic.Cast(m_Trigger);
115 if (dynaTrigger)
116 {
117 dynaTrigger.SetLocalEffects(m_AroundParticleID, m_TinyParticleID, m_PPERequesterIdx);
118 dynaTrigger.SetAreaState(m_DecayState);
119 }
120 }
121
123 {
124 super.OnVariablesSynchronized();
125
126 if (!m_ToxicClouds)
127 m_ToxicClouds = new array<Particle>();
128
129 switch (m_DecayState)
130 {
131 case eAreaDecayStage.LIVE:
133 break;
134
135 case eAreaDecayStage.DECAY_START:
136 // We go through all the particles bound to this area and update relevant parameters
137 //Debug.Log("We start decay");
138 foreach ( Particle p : m_ToxicClouds )
139 {
140 p.SetParameter( 0, EmitorParam.BIRTH_RATE, DECAY_START_PART_BIRTH_RATE );
141 p.SetParameter( 0, EmitorParam.SIZE, DECAY_START_PART_SIZE );
142 }
143
144 break;
145
146 case eAreaDecayStage.DECAY_END:
147 // We go through all the particles bound to this area and update relevant parameters
148 //Debug.Log("We finish decay");
149 foreach ( Particle prt : m_ToxicClouds )
150 {
151 prt.SetParameter( 0, EmitorParam.BIRTH_RATE, DECAY_END_PART_BIRTH_RATE );
152 prt.SetParameter( 0, EmitorParam.SIZE, DECAY_END_PART_SIZE );
153 }
154
155 break;
156
157 default:
158 break;
159 }
160 }
161}
eBleedingSourceType m_Type
float m_Radius
Определения AIGroupBehaviour.c:10
override void InitZoneServer()
Определения ContaminatedArea.c:56
override void InitZoneClient()
Определения ContaminatedArea.c:54
override void OnVariablesSynchronized()
Определения ContaminatedArea_Dynamic.c:94
override void OnParticleAllocation(ParticleManager pm, array< ParticleSource > particles)
Определения ContaminatedArea_DynamicBase.c:87
override void InitZone()
Определения ContaminatedArea_DynamicBase.c:61
const int DECAY_START_PART_BIRTH_RATE
Определения ContaminatedArea_DynamicBase.c:16
float GetFinishDecayLifetime()
Определения ContaminatedArea_DynamicBase.c:40
const float DECAY_START_PART_SIZE
Определения ContaminatedArea_DynamicBase.c:15
void ContaminatedArea_DynamicBase()
Определения ContaminatedArea_DynamicBase.c:22
const float FINISH_DECAY_LIFETIME
Определения ContaminatedArea_DynamicBase.c:20
enum eAreaDecayStage m_DecayState
const float DECAY_END_PART_SIZE
Определения ContaminatedArea_DynamicBase.c:17
float GetStartDecayLifetime()
Определения ContaminatedArea_DynamicBase.c:35
const int DECAY_END_PART_BIRTH_RATE
Определения ContaminatedArea_DynamicBase.c:18
eAreaDecayStage
Определения ContaminatedArea_DynamicBase.c:2
@ DECAY_START
Определения ContaminatedArea_DynamicBase.c:6
@ DECAY_END
Определения ContaminatedArea_DynamicBase.c:7
@ LIVE
Определения ContaminatedArea_DynamicBase.c:5
const float START_DECAY_LIFETIME
Определения ContaminatedArea_DynamicBase.c:19
void SetDecayState(int newState)
Определения ContaminatedArea_DynamicBase.c:46
void ContaminatedTrigger_Dynamic()
Определения ContaminatedTrigger.c:96
vector m_Position
Cached world position.
Определения Effect.c:43
eZoneType
Определения EffectArea.c:5
class SEffectManager START
float GetRemainingTime()
Определения NotificationSystem.c:40
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
void CreateTrigger()
Определения TrapBase.c:474
Legacy way of using particles in the game.
Определения Particle.c:7
Entity which has the particle instance as an ObjectComponent.
Определения ParticleSource.c:128
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:119
@ INIT
Определения EnEntity.c:81
EmitorParam
Определения EnVisual.c:114