public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { if (IsDestroyed) { return(false); } ResetHueVector(); if (AnimationGraphic != _displayedGraphic || Texture == null || Texture.IsDisposed) { _displayedGraphic = AnimationGraphic; Texture = ArtLoader.Instance.GetTexture(AnimationGraphic); Bounds.X = -((Texture.Width >> 1) - 22); Bounds.Y = -(Texture.Height - 44); Bounds.Width = Texture.Width; Bounds.Height = Texture.Height; } posX += (int)Offset.X; posY += (int)(Offset.Y + Offset.Z); //posX += 22; //posY += 22; if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { HueVector.X = Constants.OUT_RANGE_COLOR; HueVector.Y = 1; } else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect) { HueVector.X = Constants.DEAD_RANGE_COLOR; HueVector.Y = 1; } else { ShaderHuesTraslator.GetHueVector(ref HueVector, Hue); } //Engine.DebugInfo.EffectsRendered++; if (FixedDir) { batcher.DrawSprite(Texture, posX, posY, false, ref HueVector); } else { batcher.DrawSpriteRotated(Texture, posX, posY, Bounds.X, Bounds.Y, ref HueVector, AngleToTarget); } //Select(posX, posY); Texture.Ticks = Time.Ticks; ref readonly StaticTiles data = ref TileDataLoader.Instance.StaticData[_displayedGraphic];
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); }