Bricklayer.Client.Entities.Player.Update C# (CSharp) Method

Update() public method

Updates the player physics, states, etc
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void
        public void Update(GameTime gameTime)
        {
            //Clear Input
            if (IsMine)
                IsJumping = false;
            //Make sure PreviousDisplay is one frame behind DisplayState
            PreviousState = SimulationState;
            SimulationState.Bounds = Bounds;
            //Handle Movement and Collision
            if (IsMine && ((Map)Map).Game.IsActive)
            {
                if (HandleInput())
                {
                    Game.NetManager.Send(new PlayerStateMessage(this));
                }
            }
            ApplyPhysics(gameTime);
            // Set DisplayState
            if (IsMine)
                DisplayState = SimulationState;
            else
                Interpolate(gameTime);

            DisplayState.Position.X = Math.Max(0, DisplayState.Position.X);
            DisplayState.Position.Y = Math.Max(0, DisplayState.Position.Y);
        }