Пример #1
0
        void Setup()
        {
            Networking.PrimarySocket.playerConnected += (NetworkingPlayer player) =>
            {
                networkingManager.OnClientConnected(player);
            };

            Networking.ClientReady(Networking.PrimarySocket);
        }
Пример #2
0
        protected override void NetworkStart()
        {
            base.NetworkStart();

            if (OwningNetWorker.IsServer)             // Fired whenever a client says that they are ready on the network
            {
                OwningNetWorker.clientReady += (player) => { Debug.Log("The player with id " + player.NetworkId + " is ready to go!"); }
            }
            ;
            else             // Tell the server that we are ready on the network, this can be called at any time
            {
                Networking.ClientReady(OwningNetWorker);
            }

            enteredProximity += (mine, other) => { Debug.Log(other.name + " entered my (" + mine.name + ") proximity"); };
            exitedProximity  += (mine, other) => { Debug.Log(other.name + " left my (" + mine.name + ") proximity"); };
        }
Пример #3
0
        protected override void NetworkStart()
        {
            base.NetworkStart();

            if (OwningNetWorker.IsServer)             // Fired whenever a client says that they are ready on the Network
            {
                OwningNetWorker.clientReady += (player) => { Debug.Log("The player with id " + player.NetworkId + " is ready to go!"); }
            }
            ;
            else             // Tell the server that we are ready on the Network, this can be called at any time
            {
                Networking.ClientReady(OwningNetWorker);
            }

            enteredProximity += (mine, other) => { Debug.Log(other.name + " entered my (" + mine.name + ") proximity"); };
            exitedProximity  += (mine, other) => { Debug.Log(other.name + " left my (" + mine.name + ") proximity"); };
            if (IsOwner)
            {
                //Only allow the owner to register this event
                Networking.PrimarySocket.AddCustomDataReadEvent(SERVER_ONLY, ReadFromNetwork);
            }
        }