Files
CalamityModPublic/Particles/BloomParticle.cs
Xyk bf653ecd97 Seekers, Hellblasts, and BH end telegraph
Seekers leave behind a telegraph that fires after a moment
Hellblast have a telegraph before exploding and will start the telegraph if they go within 10 blocks of the player or after they would normally expire. they now pass through walls
Bullet Hells now have an audio telegraph for when they are about to end so you are prepared for scal to immediately continue her assault where she left off once the BH has ended
2023-11-29 17:36:22 -08:00

54 lines
1.9 KiB
C#

using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
using static CalamityMod.CalamityUtils;
namespace CalamityMod.Particles
{
public class BloomParticle : Particle
{
public override string Texture => "CalamityMod/Particles/BloomCircle";
public override bool UseAdditiveBlend => true;
public override bool SetLifetime => true;
public override bool UseCustomDraw => true;
private float OriginalScale;
private float FinalScale;
private float opacity;
private Color BaseColor;
private bool Fade;
public BloomParticle(Vector2 position, Vector2 velocity, Color color, float originalScale, float finalScale, int lifeTime, bool fade = true)
{
Position = position;
Velocity = velocity;
BaseColor = color;
OriginalScale = originalScale;
FinalScale = finalScale;
Scale = originalScale;
Lifetime = lifeTime;
Fade = fade;
}
public override void Update()
{
float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) });
Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress);
if (Fade)
opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2);
Color = BaseColor * (Fade ? opacity : 1);
Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f);
}
public override void CustomDraw(SpriteBatch spriteBatch)
{
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * (Fade ? opacity : 1), 0, tex.Size() / 2f, Scale, SpriteEffects.None, 0);
}
}
}