File size: 1,527 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
class RemotePlayerDamageDebug
{
	const int MAX_DAMAGE_RECORDS = 5;
	PlayerBase m_Player;
	bool m_ChangedSinceSerialization;
	
	ref array<ref DamageData> m_DamageList = new array<ref DamageData>;
	
	void RemotePlayerDamageDebug(PlayerBase player)
	{
		m_Player = player;
	}
	
	void AddDamage(float value_global, float value_blood, float value_shock)
	{
		m_ChangedSinceSerialization = true;
		DamageData damage_data = new DamageData( value_global, value_blood, value_shock );
		m_DamageList.InsertAt(damage_data,0);
		if( m_DamageList.Count() > MAX_DAMAGE_RECORDS )
		{
			m_DamageList.RemoveOrdered(MAX_DAMAGE_RECORDS);
		}
	}
	
	void InsertDamageObject(DamageData damage_object)
	{
		m_DamageList.Insert(damage_object);
	}
	

	PlayerBase GetPlayer()
	{
		return m_Player;
	}
	
	
	void Get(array<ref DamageData> damage_list)
	{
		for(int i = 0; i < m_DamageList.Count(); i++)
		{
			damage_list.Insert(m_DamageList.Get(i));
		}
	}
	
	void GetReversed(array<ref DamageData> damage_list)
	{
		int index = m_DamageList.Count() - 1;
		for(; index >= 0; index--)
		{
			damage_list.Insert(m_DamageList.Get(index));
		}
	}
	
	void Serialize(array<ref RemotePlayerDamageDebug> list)
	{
		if( m_ChangedSinceSerialization )
		{
			list.Insert(this);
		}
		m_ChangedSinceSerialization = false;
	}
	
	void Debug()
	{
		string output;
		for(int i = 0; i < m_DamageList.Count(); i++)
		{
			output = output + m_DamageList.Get(i).ToString() + ", ";
		}
		PrintString("damage values for player " + m_Player.ToString()+":" + output);
		
	}
	
}