From 580d9a2327952a029a76892279bb5002ae4a20b5 Mon Sep 17 00:00:00 2001 From: rawer470 Date: Fri, 16 Aug 2024 15:31:58 +0300 Subject: [PATCH] ChangeMethodUpdateServer --- ZoFo/GameCore/Server.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs index 5385ce5..5fcb39c 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -16,6 +16,7 @@ namespace ZoFo.GameCore public class Server { private ServerNetworkManager networkManager; + private int ticks = 0; public Server() { networkManager = new ServerNetworkManager(); @@ -61,12 +62,20 @@ namespace ZoFo.GameCore private List entities; //entity public void Update(GameTime gameTime) { - foreach (var go in gameObjects) + if (ticks == 3) //ОБРАБАТЫВАЕТСЯ 20 РАЗ В СЕКУНДУ { - go.UpdateLogic(gameTime); + foreach (var go in gameObjects) + { + go.UpdateLogic(gameTime); + } + ticks = 0; + networkManager.SendData(); } + ticks++; } + + /// /// Регистрирует игровой объект ///