Moved to post DoG Third swing deals extra damage Is now not scaled up and as a result is much harder to use and also stronger Has GFB functionality
61 lines
2.7 KiB
C#
61 lines
2.7 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Particles
|
|
{
|
|
public class SparkleParticle : Particle
|
|
{
|
|
public override string Texture => "CalamityMod/Particles/Sparkle2";
|
|
public bool UseAltVisual = true;
|
|
public override bool UseAdditiveBlend => UseAltVisual;
|
|
public override bool UseCustomDraw => true;
|
|
public override bool SetLifetime => true;
|
|
public override bool Important => imporant;
|
|
|
|
public bool imporant;
|
|
private float Spin;
|
|
private float opacity;
|
|
private Color Bloom;
|
|
private Color LightColor => Bloom * opacity;
|
|
private float BloomScale;
|
|
|
|
public SparkleParticle(Vector2 position, Vector2 velocity, Color color, Color bloom, float scale, int lifeTime, float rotationSpeed = 0f, float bloomScale = 1f, bool AddativeBlend = true, bool needed = false)
|
|
{
|
|
Position = position;
|
|
Velocity = velocity;
|
|
Color = color;
|
|
Bloom = bloom;
|
|
Scale = scale;
|
|
Lifetime = lifeTime;
|
|
Rotation = Main.rand.NextFloat(MathHelper.TwoPi);
|
|
Spin = rotationSpeed;
|
|
BloomScale = bloomScale;
|
|
UseAltVisual = AddativeBlend;
|
|
imporant = needed;
|
|
}
|
|
|
|
public override void Update()
|
|
{
|
|
opacity = (float)Math.Sin(LifetimeCompletion * MathHelper.Pi);
|
|
Lighting.AddLight(Position, LightColor.R / 255f, LightColor.G / 255f, LightColor.B / 255f);
|
|
Velocity *= 0.95f;
|
|
Rotation += Spin * ((Velocity.X > 0) ? 1f : -1f);
|
|
}
|
|
|
|
public override void CustomDraw(SpriteBatch spriteBatch)
|
|
{
|
|
Texture2D starTexture = ModContent.Request<Texture2D>(Texture).Value;
|
|
Texture2D bloomTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
|
//Ajust the bloom's texture to be the same size as the star's
|
|
float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height;
|
|
|
|
spriteBatch.Draw(bloomTexture, Position - Main.screenPosition, null, Bloom * opacity * 0.5f, 0, bloomTexture.Size()/2f, Scale * BloomScale * properBloomSize, SpriteEffects.None, 0);
|
|
spriteBatch.Draw(starTexture, Position - Main.screenPosition, null, Color * opacity * 0.5f, Rotation + MathHelper.PiOver4, starTexture.Size() / 2f, Scale * 0.75f, SpriteEffects.None, 0);
|
|
spriteBatch.Draw(starTexture, Position - Main.screenPosition, null, Color * opacity, Rotation, starTexture.Size() / 2f, Scale, SpriteEffects.None, 0);
|
|
}
|
|
}
|
|
}
|