Example #1
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (!AllowedToDraw || IsDisposed)
            {
                return(false);
            }

            if (Texture == null || Texture.IsDisposed || _oldGraphic != Graphic)
            {
                _oldGraphic = Graphic;

                ArtTexture texture = FileManager.Art.GetTexture(Graphic);
                Texture = texture;
                Bounds  = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height);

                FrameInfo.Width  = texture.ImageRectangle.Width;
                FrameInfo.Height = texture.ImageRectangle.Height;

                FrameInfo.X = (Texture.Width >> 1) - 22 - texture.ImageRectangle.X;
                FrameInfo.Y = Texture.Height - 44 - texture.ImageRectangle.Y;
            }

            if (_isFoliage)
            {
                if (CharacterIsBehindFoliage)
                {
                    if (AlphaHue != 76)
                    {
                        ProcessAlpha(76);
                    }
                }
                else
                {
                    if (AlphaHue != 0xFF)
                    {
                        ProcessAlpha(0xFF);
                    }
                }
            }

            if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ViewRange)
            {
                HueVector = new Vector3(Constants.OUT_RANGE_COLOR, 1, HueVector.Z);
            }
            else if (World.Player.IsDead && Engine.Profile.Current.EnableBlackWhiteEffect)
            {
                HueVector = new Vector3(Constants.DEAD_RANGE_COLOR, 1, HueVector.Z);
            }
            else
            {
                HueVector = ShaderHuesTraslator.GetHueVector(Hue, _isPartialHue, 0, false);
            }

            Engine.DebugInfo.StaticsRendered++;
            base.Draw(batcher, position, objectList);

            if (_border)
            {
                if (_borderTexture == null)
                {
                    _borderTexture = new Texture2D(batcher.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
                    _borderTexture.SetData(new Color[] { _borderColor });
                }
                batcher.DrawBorder(_borderTexture, new Rectangle((int)position.X - FrameInfo.X, (int)position.Y - FrameInfo.Y, FrameInfo.Width, FrameInfo.Height));
            }

            return(true);
        }