This commit is contained in:
Ivan Filipenkov 2023-08-18 17:48:08 +03:00
parent f72cc03c66
commit 3b0b3d9b15

View file

@ -30,6 +30,8 @@ namespace DangerousD.GameCore
public List<GameObject> otherObjects = new();
public Vector4 CameraBorder;
public Player GetPlayer1 { get; private set; }
private int _lastUpdate = 0;
public GameManager()
{
others = new List<GameObject>();
@ -131,9 +133,13 @@ namespace DangerousD.GameCore
public void Update(GameTime gameTime)
{
if (AppManager.Instance.NetworkTasks.Count > 0)
{
if (gameTime.ElapsedGameTime.Milliseconds - _lastUpdate > 1000)
{
AppManager.Instance.NetworkManager.SendMsg(AppManager.Instance.NetworkTasks.ToList());
AppManager.Instance.NetworkTasks.Clear();
_lastUpdate = gameTime.ElapsedGameTime.Milliseconds;
}
}
foreach (var item in BackgroundObjects)
item.Update(gameTime);