Made Seraphim less laggy

This commit is contained in:
Dominic authored and Cameron Ewell committed 2022-02-21 22:03:16 -05:00
1 parent 93199e2889
commit aef3de2922
4 files changed
+12 -9

No files matched your search

@@ -55,8 +55,11 @@ namespace CalamityMod.Projectiles.BaseProjectiles
float idealLaserLength = DetermineLaserLength();
LaserLength = MathHelper.Lerp(LaserLength, idealLaserLength, 0.9f); // Very quickly approach the ideal laser length.
DelegateMethods.v3_1 = LightCastColor.ToVector3();
Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight));
if (LightCastColor != Color.Transparent)
{
DelegateMethods.v3_1 = LightCastColor.ToVector3();
Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.width * projectile.scale, DelegateMethods.CastLight);
}
}
/// <summary>
@@ -204,10 +207,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles
}
public override bool ShouldUpdatePosition() => false;
#endregion
#endregion
#region Overridable Properties
public abstract float Lifetime { get; }
#region Overridable Properties
public abstract float Lifetime { get; }
public abstract float MaxScale { get; }
public abstract float MaxLaserLength { get; } // Be careful with this. Going too high will cause lag.
public abstract Texture2D LaserBeginTexture { get; }
+1 -1
View File
@@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue
public override void Kill(int timeLeft)
{
// Release a puff of golden light dust.
for (int i = 0; i < 24; i++)
for (int i = 0; i < 15; i++)
{
Dust light = Dust.NewDustPerfect(projectile.Center, 267);
light.color = Color.Lerp(Color.Gold, Color.White, Main.rand.NextFloat(0.5f, 1f));
+2 -2
View File
@@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Rogue
set => projectile.ai[1] = value;
}
public override float MaxScale => 1f;
public override float MaxLaserLength => 1600f;
public override float MaxLaserLength => 1000f;
public override float Lifetime => 50;
public override Color LaserOverlayColor
{
@@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue
return color;
}
}
public override Color LightCastColor => Color.White;
public override Color LightCastColor => Color.Transparent;
public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SeraphimBeamLarge");
public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/SeraphimBeamLargeMiddle");
public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/SeraphimBeamLargeEnd");
+1 -1
View File
@@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Rogue
projectile.Opacity = (float)Math.Pow(1f - Time / SlowdownTime, 2D);
projectile.velocity *= SlowdownFactor;
int lightDustCount = (int)MathHelper.Lerp(10f, 1f, projectile.Opacity);
int lightDustCount = (int)MathHelper.Lerp(8f, 1f, projectile.Opacity);
for (int i = 0; i < lightDustCount; i++)
{
Vector2 dustSpawnPosition = projectile.Center + Main.rand.NextVector2Unit() * (1f - projectile.Opacity) * 45f;