MiningGameServer.NetworkPlayer.EntityMovement C# (CSharp) Méthode

EntityMovement() public méthode

public EntityMovement ( ) : void
Résultat void
        public override void EntityMovement()
        {
            if (BoundBox.Left < 0) EntityPosition.X = BoundBox.Width / 2 + 1;
            if (BoundBox.Top < 0) EntityPosition.Y = BoundBox.Height / 2 + 1;
            if (BoundBox.Right > GameServer.BlockSize * GameServer.WorldSizeX) EntityPosition.X = GameServer.BlockSize * GameServer.WorldSizeX - (BoundBox.Width / 2);
            if (BoundBox.Bottom > GameServer.BlockSize * GameServer.WorldSizeY) EntityPosition.Y = GameServer.BlockSize * GameServer.WorldSizeY - (BoundBox.Height / 2);

            //Didn't want to make a new BoundBox so this'll do. Gets the tiles the player will be in with his velocity.

            EntityPosition += EntityVelocity;

            if (EntityVelocity != Vector2.Zero)
                PlayerCollisions();

            BlockCollisions();

            if (EntityVelocity.Y < 6)
                EntityVelocity.Y += 1; // Gravity! This is a really nice side effect: The code for not allowing the player to go through a block downwards already exists, so I just need to add this one line to add gravity!

            EntityVelocity = EntityVelocity.ApproachZeroX();

            if (EntityVelocity.Y != 1)
                Falling = true;
        }