File tree Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ public class KBEMain : MonoBehaviour
2121 public string persistentDataPath = "Application.persistentDataPath" ;
2222 public bool syncPlayer = true ;
2323 public int threadUpdateHZ = 10 ;
24+ public int serverHeartbeatTick = 15 ;
2425 public int SEND_BUFFER_MAX = ( int ) KBEngine . NetworkInterface . TCP_PACKET_MAX ;
2526 public int RECV_BUFFER_MAX = ( int ) KBEngine . NetworkInterface . TCP_PACKET_MAX ;
2627 public bool useAliasEntityID = true ;
@@ -62,6 +63,7 @@ public virtual void initKBEngine()
6263
6364 args . syncPlayer = syncPlayer ;
6465 args . threadUpdateHZ = threadUpdateHZ ;
66+ args . serverHeartbeatTick = serverHeartbeatTick ;
6567 args . useAliasEntityID = useAliasEntityID ;
6668 args . isOnInitCallPropertysSetMethods = isOnInitCallPropertysSetMethods ;
6769
Original file line number Diff line number Diff line change @@ -324,7 +324,7 @@ public void sendTick()
324324 // 更新玩家的位置与朝向到服务端
325325 updatePlayerToServer ( ) ;
326326
327- if ( span . Seconds > 15 )
327+ if ( span . Seconds > _args . serverHeartbeatTick )
328328 {
329329 span = _lastTickCBTime - _lastTickTime ;
330330
Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ public class KBEngineArgs
4646 // 线程主循环处理频率
4747 public int threadUpdateHZ = 10 ;
4848
49+ // 心跳频率(tick数)
50+ public int serverHeartbeatTick = 15 ;
51+
4952 public int getRecvBufferSize ( )
5053 {
5154 return ( int ) RECV_BUFFER_MAX ;
You can’t perform that action at this time.
0 commit comments