DayZ 1.28
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 // We spawn VFX on client
73 PlaceParticles(m_Position, m_Radius, m_InnerRings, m_InnerSpacing, m_OuterRingToggle, m_OuterSpacing, m_OuterRingOffset, m_ParticleID);
74 }
75
76 override void InitZoneServer()
77 {
78 super.InitZoneServer();
79
80 // We create the trigger on server
81 if (m_TriggerType != "")
82 CreateTrigger(m_PositionTrigger, m_Radius);
83 }
84
86 {
87 super.OnParticleAllocation(pm, particles);
88
90 {
91 foreach (ParticleSource p : particles)
92 {
93 if (m_DecayState == eAreaDecayStage.DECAY_END)
94 {
95 p.SetParameter(0, EmitorParam.BIRTH_RATE, DECAY_END_PART_BIRTH_RATE);
96 p.SetParameter(0, EmitorParam.SIZE, DECAY_END_PART_SIZE);
97 }
98 else
99 {
100 p.SetParameter(0, EmitorParam.BIRTH_RATE, DECAY_START_PART_BIRTH_RATE);
101 p.SetParameter(0, EmitorParam.SIZE, DECAY_START_PART_SIZE);
102 }
103 }
104 }
105 }
106
107 override void CreateTrigger(vector pos, int radius)
108 {
109 super.CreateTrigger(pos, radius);
110
111 // This handles the specific case of dynamic triggers as some additionnal parameters are present
112 ContaminatedTrigger_Dynamic dynaTrigger = ContaminatedTrigger_Dynamic.Cast( m_Trigger );
113 if (dynaTrigger)
114 {
115 dynaTrigger.SetLocalEffects( m_AroundParticleID, m_TinyParticleID, m_PPERequesterIdx );
116 dynaTrigger.SetAreaState( m_DecayState );
117 }
118 }
119
121 {
122 super.OnVariablesSynchronized();
123
124 if (!m_ToxicClouds)
125 m_ToxicClouds = new array<Particle>();
126
127 switch ( m_DecayState )
128 {
129 case eAreaDecayStage.LIVE:
131 break;
132 case eAreaDecayStage.DECAY_START:
133 {
134 // We go through all the particles bound to this area and update relevant parameters
135 //Debug.Log("We start decay");
136 foreach ( Particle p : m_ToxicClouds )
137 {
138 p.SetParameter( 0, EmitorParam.BIRTH_RATE, DECAY_START_PART_BIRTH_RATE );
139 p.SetParameter( 0, EmitorParam.SIZE, DECAY_START_PART_SIZE );
140 }
141
142 break;
143 }
144 case eAreaDecayStage.DECAY_END:
145 {
146 // We go through all the particles bound to this area and update relevant parameters
147 //Debug.Log("We finish decay");
148 foreach ( Particle prt : m_ToxicClouds )
149 {
150 prt.SetParameter( 0, EmitorParam.BIRTH_RATE, DECAY_END_PART_BIRTH_RATE );
151 prt.SetParameter( 0, EmitorParam.SIZE, DECAY_END_PART_SIZE );
152 }
153
154 break;
155 }
156 default:
157 break;
158 }
159 }
160}
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:85
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:475
Legacy way of using particles in the game.
Определения Particle.c:7
Entity which has the particle instance as an ObjectComponent.
Определения ParticleSource.c:124
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:106
@ INIT
Определения EnEntity.c:81
EmitorParam
Определения EnVisual.c:114