Exemple #1
0
        /// <summary>Sends player input to the server.</summary>
        private void SendInputToServer()
        {
            bool[] _inputs = new bool[]
            {
                Input.GetKey(KeyCode.W),
                Input.GetKey(KeyCode.S),
                Input.GetKey(KeyCode.A),
                Input.GetKey(KeyCode.D),
            };

            ClientSend.PlayerMovement(_inputs);
        }
Exemple #2
0
        public static void Welcome(Packet _packet)
        {
            string _msg  = _packet.ReadString();
            int    _myId = _packet.ReadInt();

            Debug.Log($">> Message from server: {_msg}");
            Client.instance.myId = _myId;
            ClientSend.WelcomeReceived();

            // Now that we have the client's id, connect UDP
            Client.instance.udp.Connect(((IPEndPoint)Client.instance.tcp.socket.Client.LocalEndPoint).Port);
        }