public bool AnimateHologram(Vector2 worldPos, bool isUI) { if (!this.IsActivated) { return(false); } if (HologramDefinition.IsBadType(this.Mode, this.Type)) { return(false); } // Cycle animations at all distances this.AnimateCurrentFrame(); if (!isUI) { int maxDistSqr = EmittersConfig.Instance.HologramMinimumRangeBeforeProject; maxDistSqr *= maxDistSqr; // Too far away? if ((Main.LocalPlayer.Center - worldPos).LengthSquared() >= maxDistSqr) { return(false); } } return(true); }
/////////// public void DrawHologram(SpriteBatch sb, Vector2 wldPos, bool isUI) { switch (this.Mode) { case HologramMode.NPC: Main.instance.LoadNPC(this.Type); break; case HologramMode.Projectile: Main.instance.LoadProjectile(this.Type); break; case HologramMode.Gore: Main.instance.LoadGore(this.Type); break; } Texture2D tex = HologramDefinition.GetTexture(this.Mode, this.Type); var frameCount = HologramDefinition.GetFrameCount(this.Mode, this.Type); var frameHeight = tex.Height / frameCount; try { switch (this.ShaderMode) { case HologramShaderMode.None: this.BeginBatch(sb, null); break; case HologramShaderMode.Vanilla: this.BeginBatch(sb, null); this.VanillaShaderBegin(tex, frameHeight); break; case HologramShaderMode.Custom: this.BeginBatch(sb, this.CustomEffectsBegin(tex)); this.CustomEffectsBegin(tex); break; } this.DrawHologramRaw(sb, wldPos, isUI, tex, frameHeight); } catch (Exception e) { Console.WriteLine(e); throw; } finally { if (this.ShaderMode != HologramShaderMode.None) { this.BatchEnd(sb); } } }