diff --git a/Particles/DesertProwlerSkull.png b/Particles/DesertProwlerSkull.png index 100d58f9ae..b5b9d0fada 100644 Binary files a/Particles/DesertProwlerSkull.png and b/Particles/DesertProwlerSkull.png differ diff --git a/Particles/DesertProwlerSkullParticle.cs b/Particles/DesertProwlerSkullParticle.cs index 2771858046..67a7da4384 100644 --- a/Particles/DesertProwlerSkullParticle.cs +++ b/Particles/DesertProwlerSkullParticle.cs @@ -1,16 +1,20 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; - +using static CalamityMod.CalamityUtils; namespace CalamityMod.Particles { public class DesertProwlerSkullParticle : Particle { public override string Texture => "CalamityMod/Particles/DesertProwlerSkull"; + public override bool UseCustomDraw => true; + public override bool UseHalfTransparency => true; private float Opacity; private Color ColorStart; private Color ColorFade; + private float BaseOpacity; public DesertProwlerSkullParticle(Vector2 position, Vector2 velocity, Color colorStart, Color colorFade, float scale, float opacity) { @@ -20,6 +24,7 @@ namespace CalamityMod.Particles ColorFade = colorFade; Scale = scale; Opacity = opacity; + BaseOpacity = opacity; Rotation = Main.rand.NextFloat(MathHelper.PiOver4 * 0.5f) - MathHelper.PiOver4 * 0.25f; } @@ -43,7 +48,21 @@ namespace CalamityMod.Particles Kill(); Color = Color.Lerp(ColorStart, ColorFade, MathHelper.Clamp((float)((255 - Opacity) - 100) / 80, 0f, 1f)) * (Opacity / 255f); + } + public CurveSegment UpsquashSegment = new CurveSegment(PolyOutEasing, 0f, 1f, 0.2f, 2); + public CurveSegment DownsquashSegment = new CurveSegment(PolyInEasing, 0.2f, 1.2f, -0.3f, 2); + public CurveSegment BumpSquashSegment = new CurveSegment(SineOutEasing, 0.3f, 0.9f, -0.05f); + public CurveSegment BumpSquash2Segment = new CurveSegment(SineInEasing, 0.6f, 0.85f, 0.15f); + public CurveSegment BumpSquash3Segment = new CurveSegment(SineBumpEasing, 0.76f, 1f, 0.05f); + public CurveSegment StaySegment = new CurveSegment(LinearEasing, 0.9f, 1f, 0f); + internal float Squash => PiecewiseAnimation(1 - Opacity / BaseOpacity, new CurveSegment[] { UpsquashSegment, DownsquashSegment, BumpSquashSegment, BumpSquash2Segment, BumpSquash3Segment, StaySegment }); + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D sprite = GeneralParticleHandler.GetTexture(Type); + Vector2 size = Scale * new Vector2(1 - (Squash - 1) * 0.8f, 1 + (Squash - 1) * 0.8f); + spriteBatch.Draw(sprite, Position - Main.screenPosition, null, Color, Rotation, sprite.Size() / 2f, size, 0, 0); } } }