Ejemplo n.º 1
0
        // -------------------------------------------------------------------------------
        // OnSceneLoaded
        // @Client / @Server
        // -------------------------------------------------------------------------------
        void OnSceneLoaded(Scene scene, LoadSceneMode mode)
        {
            if (NetworkServer.active && !GetIsMainZone)
            {
                if (GetSubZoneTimeoutInterval > 0)
                {
                    InvokeRepeating(nameof(CheckSubZone), GetSubZoneTimeoutInterval, GetSubZoneTimeoutInterval);
                }
            }

            if (autoConnectClient)
            {
                networkManager.StartClient();
                autoConnectClient = false;
            }
        }
Ejemplo n.º 2
0
        // -------------------------------------------------------------------------------
        // OnSceneLoaded
        // -------------------------------------------------------------------------------
        void OnSceneLoaded(Scene scene, LoadSceneMode mode)
        {
            if (NetworkServer.active)
            {
                if (zoneName == scene.name && SubZoneTimeoutInterval > 0)
                {
                    InvokeRepeating(nameof(CheckSubZone), SubZoneTimeoutInterval, SubZoneTimeoutInterval);
                }
            }

            if (autoConnectClient)
            {
                networkTransport.port = (ushort)(originalPort + zoneIndex);
                networkManager.StartClient();
                autoConnectClient = false;
            }
        }