51 lines
2.3 KiB
C#
51 lines
2.3 KiB
C#
using System;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Dusts
|
|
{
|
|
public class VoidDustInverted : ModDust
|
|
{
|
|
public override void OnSpawn(Dust dust)
|
|
{
|
|
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
|
|
}
|
|
|
|
public override bool Update(Dust dust)
|
|
{
|
|
dust.rotation += MathF.Sign(dust.velocity.X);
|
|
dust.velocity *= 0.98f;
|
|
if (dust.noGravity)
|
|
dust.scale += 0.02f;
|
|
else
|
|
dust.scale -= 0.01f;
|
|
|
|
float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f);
|
|
if (!dust.noLightEmittence)
|
|
Lighting.AddLight(dust.position, dust.color.ToVector3() * light);
|
|
|
|
return true;
|
|
}
|
|
public override bool PreDraw(Dust dust)
|
|
{
|
|
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
|
|
|
|
Texture2D solidCenter = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
|
|
Texture2D bloom2 = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
|
|
|
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/SmallBloom").Value;
|
|
|
|
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Black * 0.4f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.068f, SpriteEffects.None, 0);
|
|
if (dust.alpha < 1)
|
|
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.057f, SpriteEffects.None, 0);
|
|
|
|
Main.EntitySpriteDraw(bloom2, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom2.Size() * 0.5f, dust.scale * 0.07f, SpriteEffects.None, 0);
|
|
if (!dust.noLight)
|
|
Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.75f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
|
|
return false;
|
|
}
|
|
}
|
|
}
|