File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Assets/BossRoom/Scripts/Shared/Net Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ public ExponentialMovingAverageCalculator(float average)
42
42
const float k_PingIntervalSeconds = 0.1f ;
43
43
const float k_MaxWindowSize = k_MaxWindowSizeSeconds / k_PingIntervalSeconds ;
44
44
45
+ const float k_StrugglingNetworkConditionsRTTThreshold = 130 ;
45
46
const float k_BadNetworkConditionsRTTThreshold = 200 ;
46
47
47
48
ExponentialMovingAverageCalculator m_BossRoomRTT = new ExponentialMovingAverageCalculator ( 0 ) ;
@@ -129,6 +130,18 @@ void FixedUpdate()
129
130
if ( m_TextStat != null )
130
131
{
131
132
m_TextToDisplay = $ "RTT: { ( m_BossRoomRTT . Average * 1000 ) . ToString ( "0" ) } ms;\n UTP RTT { m_UtpRTT . Average . ToString ( "0" ) } ms";
133
+ if ( m_UtpRTT . Average > k_BadNetworkConditionsRTTThreshold )
134
+ {
135
+ m_TextStat . color = Color . red ;
136
+ }
137
+ else if ( m_UtpRTT . Average > k_StrugglingNetworkConditionsRTTThreshold )
138
+ {
139
+ m_TextStat . color = Color . yellow ;
140
+ }
141
+ else
142
+ {
143
+ m_TextStat . color = Color . white ;
144
+ }
132
145
}
133
146
134
147
if ( m_TextBadNetworkConditions != null )
You can’t perform that action at this time.
0 commit comments