예제 #1
0
    public void StartNetworkHost()
    {
        host = gameObject.AddComponent <NetworkHost>();
        NetworkSync sync = gameObject.AddComponent <NetworkSync>();

        sync.Initialize(0, "GameController");
        host.Initialize();
        matchmakingHost = GetComponent <MatchmakingHost>() ?? gameObject.AddComponent <MatchmakingHost>();
    }
예제 #2
0
 public void CleanupNetwork()
 {
     if (IsHost)
     {
         Destroy(host);
         host = null;
         Destroy(matchmakingHost);
         matchmakingHost = null;
     }
     else
     {
         Destroy(client);
         client = null;
         Destroy(matchmakingClient);
         matchmakingClient = null;
     }
     Destroy(GetComponent <NetworkSync>());
     IsHost = false;
 }