Files
CalamityModPublic/Particles/QuickSparkleParticle.cs
fryzahh 1910a4c918 Divine Meat sprites + misc
* Renamed DivineCornucopia to DivineMeat and added in its final sprites. Functionality remains the same.
* Added some minor visual additions to Divine Meat and Disgusting Meat when they are dropped on the ground in the world.
* Added some minor visual additions to Divine Swine.
* Divine Swine now increments its y-velocity while flying in random directions to prevent it from infinitely flying up and into space.
* Disgusting Meat can no longer be used while its animation is being played.
2026-05-12 12:41:59 -04:00

60 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Graphics.Shaders;
using Terraria.ModLoader;
namespace CalamityMod.Particles
{
public class QuickSparkleParticle : Particle
{
public float StoredScale;
public float LightStrength;
public bool EmitLight;
public Vector2 StretchFactor;
public QuickSparkleParticle(Vector2 position, Vector2 velocity, Color color, float scale, int lifetime, Vector2? stretchFactor = null,bool emitLight = false, float lightStrength = 1.45f)
{
Position = position;
Velocity = velocity;
Color = color;
StoredScale = scale;
Lifetime = lifetime;
StretchFactor = stretchFactor ?? new(0.75f, 1.75f);
EmitLight = emitLight;
LightStrength = lightStrength;
}
public override bool SetLifetime => true;
public override bool UseAdditiveBlend => true;
public override bool UseCustomDraw => true;
public override string Texture => "CalamityMod/ExtraTextures/ShineFlare";
public override void Update()
{
Velocity *= 0.92f;
Scale = MathHelper.Lerp(0f, StoredScale, MathF.Sin(LifetimeCompletion * MathHelper.Pi));
if (EmitLight)
Lighting.AddLight(Position, Color.ToVector3() * Scale * LightStrength);
}
public override void CustomDraw(SpriteBatch spriteBatch)
{
spriteBatch.Draw(GeneralParticleHandler.GetTexture(Type), Position - Main.screenPosition, null, Color.White, Rotation, GeneralParticleHandler.GetTexture(Type).Size() * 0.5f, Scale * StretchFactor * 0.1f, 0, 0f);
spriteBatch.Draw(GeneralParticleHandler.GetTexture(Type), Position - Main.screenPosition, null, Color, Rotation, GeneralParticleHandler.GetTexture(Type).Size() * 0.5f, Scale * StretchFactor * 0.2f, 0, 0f);
}
}
}