示例#1
0
        private void OnUpdateRemotePlayer(ref UpdateRemotePlayer p)
        {
            RemotePlayer player;

            if (remotePlayers.TryGetValue(p.Index, out player))
            {
                player.UpdateFromServer(ref p);
            }
        }
示例#2
0
        public void UpdateFromServer(ref UpdateRemotePlayer p)
        {
            Vector3 pos = p.Pos;

            pos.X += p.Speed.X * p.SenderConnection.AverageRoundtripTime * 0.5f;
            pos.Y += p.Speed.Y * p.SenderConnection.AverageRoundtripTime * 0.5f;

            Transform.Pos = pos;

            speedX = p.Speed.X;
            speedY = p.Speed.Y;

            if (currentAnimationState != p.AnimState)
            {
                SetAnimation(p.AnimState);
            }

            renderer.AnimTime = p.AnimTime;
            isFacingLeft      = p.IsFacingLeft;
        }