using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { public class AtlasMunitionsDropPodUpper : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { Projectile.width = 82; Projectile.height = 80; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.minionSlots = 1f; Projectile.timeLeft = 240; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.minion = true; Projectile.DamageType = DamageClass.Summon; } public override void AI() { // Fly into the sky. Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y - 0.2f, -29f, 0f); // Calculate frames. Projectile.frameCounter++; Projectile.frame = Projectile.frameCounter / 6 % Main.projFrames[Type]; } public override bool? CanDamage() => false; public override void PostDraw(Color lightColor) { Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Summon/AtlasMunitionsDropPodUpperGlow").Value; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 drawPosition = Projectile.Center - Main.screenPosition; Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(Color.White), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, 0, 0); } } }