Ejemplo n.º 1
0
        public override void Update()
        {
            if (!_tickTimer.TryCycle())
            {
                return;
            }

            base.Update();

            // In case we disconnected.
            if (_disposed)
            {
                return;
            }

            if (!(_time is null))
            {
                _time.Update();

                var player      = GM.CurrentPlayerBody;
                var transforms  = new PlayerTransformsMessage(player.Head, player.LeftHand, player.RightHand);
                var timestamped = new Timestamped <PlayerTransformsMessage>(_time.Now, transforms);

                Server.Send(timestamped);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///		Start an offset update if enough time has passed.
        /// </summary>
        /// <param name="server">The server peer.</param>
        public void Update()
        {
            if (!_pingTimer.TryCycle())
            {
                return;
            }

            _server.Send(PingMessage.Now);

            Sent?.Invoke();
        }