This commit is contained in:
2024-04-26 20:06:38 +03:00
parent 0da7f2d93e
commit e023dfce69
21 changed files with 73 additions and 466 deletions

View File

@@ -19,15 +19,7 @@ public static partial class NetworkManager
public static bool ConnectServer(string serverAddress = "localhost", bool listenServer = false)
{
if (!listenServer)
{
Cleanup();
//WorldStateManager.Init();
clientWorldStateManager = new WorldStateManager(isClient: true);
}
else
{
clientWorldStateManager = new WorldStateManager(isLocalClient: true);
}
ServerAddress = serverAddress;
//var driver = Object.New(typeof(ENetDriver));
@@ -56,6 +48,17 @@ public static partial class NetworkManager
Console.Print("Failed to connect to the server.");
return false;
}
Debug.Log("Connected...");
if (!listenServer)
{
//WorldStateManager.Init();
clientWorldStateManager = new WorldStateManager(isClient: true);
}
else
{
clientWorldStateManager = new WorldStateManager(isLocalClient: true);
}
Scripting.FixedUpdate += OnClientNetworkUpdate;
if (!listenServer)