Exemple #1
0
 public void OnStartClient()
 {
     _fixedUpdater = new FixedUpdater((int)(NetworkTime.Milliseconds), timeStepMilliseconds, time =>
     {
         _inputMessage.Time = time;
         NetworkClient.Send(_inputMessage, 1);
         NetworkInput.AddKeyMap(_inputMessage.Keymap);
         _inputMessage.Keymap = 0u;
     });
 }
Exemple #2
0
 private void Update()
 {
     if (NetworkInput.GetKeyDown(Keys.Use))
     {
         Debug.Log("Use key down!");
     }
     if (NetworkInput.GetKeyUp(Keys.Use))
     {
         Debug.Log("Use key up!");
     }
 }
Exemple #3
0
        public void OnStartServer()
        {
            NetworkServer.NewConnectionEvent += NetworkInput.AddConnection;

            NetworkServer.ConnectionDisconnectEvent += NetworkInput.RemoveConnection;

            NetworkServer.RegisterHandler <InputMessage>(data =>
            {
//				Debug.Log($"Time: {data.Message.Time}, Keys: {data.Message.Keymap}");
                if (_lastInputTime < data.Message.Time)
                {
                    _lastInputTime = data.Message.Time;
                    NetworkInput.AddKeyMap(data.Connection, data.Message.Keymap);
                }
            });
        }