コード例 #1
0
 protected override void TearDownGameScene()
 {
     base.TearDownGameScene();
     if (simulation != null)
     {
         simulation = null;
     }
     if (hotelGameServer != null)
     {
         hotelGameServer.Destroy();
         hotelGameServer = null;
     }
 }
コード例 #2
0
    public async Task StartServer(string host, int port, bool loadScene)
    {
        netChannel.StartServer(port);
        // TODO: Determine why this extra wait is needed on the startup case.
        // It doesnt seem to cause an error when omitted, but the POST below never happens.
        await Hotel.HotelClient.Instance.WaitUntilInitialized();

        hotelGameServer = await Hotel.HotelClient.Instance.StartHostingServer(
            host, port, 8, "Test");

        Debug.Log($"Registered game with master server.");
        if (loadScene)
        {
            LoadGameScene();
        }

        // Initialize simulation.
        simulation = new ServerSimulation(
            debugPhysicsErrorChance, playerManager, networkObjectManager, this);
    }