Ejemplo n.º 1
0
        protected void drawInGameObjects(float maxdepth, int firstX, int firstY, int offsetX, int offsetY)
        {
            foreach (InGameObject obj in InGameObjects())
            {
                if (!obj.Visible)
                {
                    continue;
                }

                Rectangle sourceRectangle = obj.SourceRectangle;

                Rectangle destinationRectangle = obj.MakeDestinationRectangle(firstX, firstY, offsetX, offsetY);

                Rectangle objBox = obj.InWorldSquareBoundingBox;

                float depth = calculateDepthOffset(maxdepth, objBox.Right - firstX - 1, objBox.Top - firstY);
                depth -= heightRowDepthMod; //since it's above the ground, level with the first level of walls

                spriteBatch.Draw(
                    obj.Texture,
                    destinationRectangle,
                    sourceRectangle,
                    Blending.MultiplyBlend(obj.Tint, CellTint(obj.SquareCoordinate)),
                    0f,           //no rotation
                    Vector2.Zero, //don't use origin
                    SpriteEffects.None,
                    depth);
            }
        }