File size: 1,606 Bytes
24b81cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
class PMTF : TestFramework
{
	private static int PM_CREATED = 0;
	private ref map<int, ref ParticleManager> m_Managers = new map<int, ref ParticleManager>();
	
	//---------------------------------------------------------------------------
	// Manager management
	//---------------------------------------------------------------------------
	int InsertManager(ParticleManager pm)
	{
		Assert(m_Managers.Insert(PM_CREATED, pm));
		++PM_CREATED;
		
		return PM_CREATED - 1;
	}
	
	bool GetManager(int id, out ParticleManager pm)
	{
		return m_Managers.Find(id, pm);
	}
	
	//---------------------------------------------------------------------------
	// Prints
	//---------------------------------------------------------------------------
	protected void PrintPMStats(notnull ParticleManager pm)
	{
		Debug.ParticleLog(string.Format(
			"Poolsize: %1 | Allocated: %2 | Virtual: %3 | Playing: %4", pm.GetPoolSize(), pm.GetAllocatedCount(), pm.GetVirtualCount(), pm.GetPlayingCount()),
		this, "PrintPMStats", pm);
	}
	
	protected void PrintActiveStats()
	{
		Debug.ParticleLog(string.Format(
			"Active ParticleManagers: %1 | Active ParticleSources: %2", ParticleManager.GetStaticActiveCount(), ParticleSource.GetStaticActiveCount()),
		this, "PrintActiveStats");
	}
	
	//---------------------------------------------------------------------------
	// Helpers
	//---------------------------------------------------------------------------
	protected ParticleManager CreatePMFixedBlocking(int size)
	{
		return new ParticleManager(new ParticleManagerSettings(size, ParticleManagerSettingsFlags.BLOCKING));
	}
}