コード例 #1
0
ファイル: H3Client.cs プロジェクト: BoyStijn/H3MP
        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);
            }
        }
コード例 #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();
        }