public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { if (WeaverNPC == null) { return(false); } Texture2D ripple = mod.GetTexture("Effects/Ripple"); //Draw trail when returning to npc for (int i = 0; i < TrailLength; i++) { Vector2 position = projectile.oldPos[i] + projectile.Size / 2; float rotation = projectile.oldRot[i]; float scale = (TrailLength - i) / (float)TrailLength; float opacity = TrailProgress * scale; spriteBatch.Draw(ripple, position - Main.screenPosition, null, projectile.GetAlpha(Color.Red) * TrailProgress, 0, ripple.Size() / 2, 1.5f * scale, SpriteEffects.None, 0); spriteBatch.Draw(Main.projectileTexture[projectile.type], position - Main.screenPosition, projectile.DrawFrame(), projectile.GetAlpha(Color.Lerp(lightColor, Color.White, 0.5f)) * opacity, rotation, projectile.DrawFrame().Size() / 2, projectile.scale * scale, SpriteEffects.None, 0); spriteBatch.Draw(ModContent.GetTexture(Texture + "_glowRed"), position - Main.screenPosition, projectile.DrawFrame(), projectile.GetAlpha(Color.White) * opacity, rotation, projectile.DrawFrame().Size() / 2, projectile.scale * scale, SpriteEffects.None, 0); } spriteBatch.Draw(ripple, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(Color.Red) * TrailProgress, 0, ripple.Size() / 2, 1.5f, SpriteEffects.None, 0); Color bloomColor = Color.White; bloomColor.A = 0; float AttackProgress = StarWeaverNPC.GetBloomIntensity(WeaverNPC); //Glowy bloom during parent's starburst attacks spriteBatch.Draw(ripple, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(Color.Gold) * (1 - TrailProgress) * AttackProgress, 0, ripple.Size() / 2, 1.5f, SpriteEffects.None, 0); SpriteEffects flip = (projectile.spriteDirection < 0) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; //Bloom glowmask PulseDraw.DrawPulseEffect(PulseDraw.BloomConstant, 12, 12, delegate(Vector2 posOffset, float opacityMod) { spriteBatch.Draw(ModContent.GetTexture(Texture + "_glow"), projectile.Center - Main.screenPosition + posOffset, projectile.DrawFrame(), projectile.GetAlpha(bloomColor) * (1 - TrailProgress) * AttackProgress * opacityMod, projectile.rotation, projectile.DrawFrame().Size() / 2, projectile.scale, flip, 0); }); projectile.QuickDraw(spriteBatch, drawColor: projectile.GetAlpha(Color.Lerp(lightColor, Color.White, 0.5f))); Color glowmaskColor = Color.Lerp(Color.White, bloomColor, AttackProgress); projectile.QuickDrawGlow(spriteBatch, projectile.GetAlpha(glowmaskColor) * (1 - TrailProgress)); spriteBatch.Draw(ModContent.GetTexture(Texture + "_glowRed"), projectile.Center - Main.screenPosition, projectile.DrawFrame(), projectile.GetAlpha(Color.White) * TrailProgress, projectile.rotation, projectile.DrawFrame().Size() / 2, projectile.scale, flip, 0); return(false); }
public static float GetBloomIntensity(StarWeaverNPC starWeaver) { float AttackProgress = 0.1f; switch (starWeaver.AiState) { case STATE_STARBURST: AttackProgress = starWeaver.AiTimer / STARBURST_CHANNELTIME; AttackProgress = MathHelper.Min(AttackProgress, 1); AttackProgress = EaseFunction.EaseCubicIn.Ease(AttackProgress); break; case STATE_STARGLOOP: AttackProgress = starWeaver.AiTimer / STARGLOOP_TIME; AttackProgress = EaseFunction.EaseQuadOut.Ease(AttackProgress); AttackProgress *= 0.5f; break; } AttackProgress = Math.Max(AttackProgress * 0.75f, 0.125f); return(AttackProgress); }