GameEngine.Drawing.DrawableInstance.Draw C# (CSharp) Méthode

Draw() public méthode

public Draw ( GameTime gameTime, SpriteBatch spriteBatch, Vector2 destination, float layerDepth, float entityScaleX, float entityScaleY, float opacity, float maxY, ViewPortInfo viewPortInfo ) : Rectangle
gameTime Microsoft.Xna.Framework.GameTime
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
destination Vector2
layerDepth float
entityScaleX float
entityScaleY float
opacity float
maxY float
viewPortInfo GameEngine.Info.ViewPortInfo
Résultat Microsoft.Xna.Framework.Rectangle
        public Rectangle Draw(GameTime gameTime, SpriteBatch spriteBatch, Vector2 destination, float layerDepth, float entityScaleX, float entityScaleY, float opacity, float maxY, ViewPortInfo viewPortInfo)
        {
            int width = GetWidth(gameTime);
            int height = GetHeight(gameTime);

            int targetWidth = (int)Math.Ceiling(width * entityScaleX * viewPortInfo.ActualZoom * this.ScaleX);
            int targetHeight = (int)Math.Ceiling(height * entityScaleY * viewPortInfo.ActualZoom * this.ScaleY);

            // Draw the Object based on the current Frame dimensions and the specified Object Width Height values.
            Rectangle objectDestRect = new Rectangle(
                    (int)Math.Ceiling(destination.X) + (int)Math.Ceiling(Offset.X * viewPortInfo.ActualZoom),
                    (int)Math.Ceiling(destination.Y) + (int)Math.Ceiling(Offset.Y * viewPortInfo.ActualZoom),
                    targetWidth,
                    targetHeight
            );

            Vector2 targetOrigin = new Vector2(
                (float)Math.Ceiling(Drawable.Origin.X * width),
                (float)Math.Ceiling(Drawable.Origin.Y * height)
                );

            Color targetColor = new Color()
            {
                R = Color.R,
                G = Color.G,
                B = Color.B,
                A = (byte)(Color.A * opacity)
            };

            // Further adjust the layer depth based on this drawables layer value
            layerDepth += Layer / maxY;

            if (layerDepth > 1) layerDepth = 1;
            if (layerDepth < 0) layerDepth = 0;

            Drawable.Draw(spriteBatch, objectDestRect, targetColor, Rotation, targetOrigin, SpriteEffects, layerDepth, GetElapsedMS(gameTime));

            return objectDestRect;
        }