Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ParticlePool.cs
Go to the documentation of this file.
2
4
6{
8
9 private ParticleInstantiator _instantiator;
10
12
14 {
15 int num = 0;
16 for (int i = 0; i < num; i++)
17 {
18 if (!_particles[i].IsRestingInPool)
19 {
20 num++;
21 }
22 }
23 return num;
24 }
25
26 public ParticlePool(int initialPoolSize, ParticleInstantiator instantiator)
27 {
30 }
31
32 public T RequestParticle()
33 {
34 int count = _particles.Count;
35 for (int i = 0; i < count; i++)
36 {
37 if (_particles[i].IsRestingInPool)
38 {
39 _particles[i].FetchFromPool();
40 return _particles[i];
41 }
42 }
43 T val = _instantiator();
44 _particles.Add(val);
45 val.FetchFromPool();
46 return val;
47 }
48}
ParticlePool(int initialPoolSize, ParticleInstantiator instantiator)