示例#1
0
        public virtual bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            if (DrawTransparent)
            {
                int dist    = Distance;
                int maxDist = Engine.Profile.Current.CircleOfTransparencyRadius + 1;

                if (dist <= maxDist)
                {
                    HueVector.Z = MathHelper.Lerp(1f, 1f - dist / (float)maxDist, 0.5f);
                    //HueVector.Z = 1f - (dist / (float)maxDist);
                }
                else
                {
                    HueVector.Z = 1f - AlphaHue / 255f;
                }
            }
            else if (AlphaHue != 255)
            {
                HueVector.Z = 1f - AlphaHue / 255f;
            }


            if (Rotation != 0.0f)
            {
                if (!batcher.DrawSpriteRotated(Texture, posX, posY, Bounds.Width, Bounds.Height, Bounds.X, Bounds.Y, ref HueVector, Rotation))
                {
                    return(false);
                }
            }
            else if (IsFlipped)
            {
                if (!batcher.DrawSpriteFlipped(Texture, posX, posY, Bounds.Width, Bounds.Height, Bounds.X, Bounds.Y, ref HueVector))
                {
                    return(false);
                }
            }
            else
            {
                if (!batcher.DrawSprite(Texture, posX, posY, Bounds.Width, Bounds.Height, Bounds.X, Bounds.Y, ref HueVector))
                {
                    return(false);
                }
            }


            Select(posX, posY);

            Texture.Ticks = Engine.Ticks;

            return(true);
        }