-
Notifications
You must be signed in to change notification settings - Fork 459
Expand file tree
/
Copy pathMetricTestBase.cs
More file actions
66 lines (50 loc) · 2.19 KB
/
MetricTestBase.cs
File metadata and controls
66 lines (50 loc) · 2.19 KB
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
#if MULTIPLAYER_TOOLS
using System.Collections;
namespace Unity.Netcode.TestHelpers.Runtime.Metrics
{
internal abstract class SingleClientMetricTestBase : NetcodeIntegrationTest
{
protected override int NumberOfClients => 1;
internal NetworkManager Server { get; private set; }
internal NetworkMetrics ServerMetrics { get; private set; }
internal NetworkManager Client { get; private set; }
internal NetworkMetrics ClientMetrics { get; private set; }
protected override void OnServerAndClientsCreated()
{
Server = m_ServerNetworkManager;
Client = m_ClientNetworkManagers[0];
base.OnServerAndClientsCreated();
}
protected override IEnumerator OnStartedServerAndClients()
{
ServerMetrics = Server.NetworkMetrics as NetworkMetrics;
ClientMetrics = Client.NetworkMetrics as NetworkMetrics;
yield return base.OnStartedServerAndClients();
}
}
public abstract class DualClientMetricTestBase : NetcodeIntegrationTest
{
protected override int NumberOfClients => 2;
internal NetworkManager Server { get; private set; }
internal NetworkMetrics ServerMetrics { get; private set; }
internal NetworkManager FirstClient { get; private set; }
internal NetworkMetrics FirstClientMetrics { get; private set; }
internal NetworkManager SecondClient { get; private set; }
internal NetworkMetrics SecondClientMetrics { get; private set; }
protected override void OnServerAndClientsCreated()
{
Server = m_ServerNetworkManager;
FirstClient = m_ClientNetworkManagers[0];
SecondClient = m_ClientNetworkManagers[1];
base.OnServerAndClientsCreated();
}
protected override IEnumerator OnStartedServerAndClients()
{
ServerMetrics = Server.NetworkMetrics as NetworkMetrics;
FirstClientMetrics = FirstClient.NetworkMetrics as NetworkMetrics;
SecondClientMetrics = SecondClient.NetworkMetrics as NetworkMetrics;
yield return base.OnStartedServerAndClients();
}
}
}
#endif