Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DrawWhip_WhipMace()

static Vector2 Terraria.Main.DrawWhip_WhipMace ( Projectile proj,
List< Vector2 > controlPoints )
inlinestatic

Definition at line 33592 of file Main.cs.

33593 {
33595 if (proj.spriteDirection == 1)
33596 {
33597 spriteEffects ^= SpriteEffects.FlipHorizontally;
33598 }
33601 int height = rectangle.Height;
33602 rectangle.Height -= 2;
33603 Vector2 vector = rectangle.Size() / 2f;
33605 for (int i = 0; i < controlPoints.Count - 1; i++)
33606 {
33607 bool flag = false;
33608 Vector2 origin = vector;
33609 float scale = 1f;
33610 if (i == 0)
33611 {
33612 origin.Y -= 4f;
33613 flag = true;
33614 }
33615 else if (i % 2 == 0)
33616 {
33617 flag = true;
33618 int num = 1;
33619 if (i > 10)
33620 {
33621 num = 2;
33622 }
33623 if (i > 20)
33624 {
33625 num = 3;
33626 }
33627 rectangle.Y = height * num;
33628 }
33629 if (i == controlPoints.Count - 2)
33630 {
33631 flag = true;
33632 rectangle.Y = height * 4;
33633 scale = 1.3f;
33634 Projectile.GetWhipSettings(proj, out var timeToFlyOut, out var _, out var _);
33635 float t = proj.ai[0] / timeToFlyOut;
33636 float amount = Utils.GetLerpValue(0.1f, 0.7f, t, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, t, clamped: true);
33637 scale = MathHelper.Lerp(0.5f, 2f, amount);
33638 }
33641 if (flag)
33642 {
33643 float rotation = vector4.ToRotation() - (float)Math.PI / 2f;
33644 Microsoft.Xna.Framework.Color color = Lighting.GetColor(vector3.ToTileCoordinates());
33645 spriteBatch.Draw(value, vector2 - screenPosition, rectangle, color, rotation, origin, scale, spriteEffects, 0f);
33646 }
33647 vector2 += vector4;
33648 }
33649 return vector2;
33650 }
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
const double PI
Definition Math.cs:16
static Asset< Texture2D >[] Projectile
static SpriteBatch spriteBatch
Definition Main.cs:974
static Vector2 screenPosition
Definition Main.cs:1715

References System.Collections.Generic.Dictionary< TKey, TValue >.Count, Terraria.Lighting.GetColor(), Terraria.Utils.GetLerpValue(), Terraria.Projectile.GetWhipSettings(), System.Text.RegularExpressions.i, Microsoft.Xna.Framework.MathHelper.Lerp(), System.Math.PI, Terraria.GameContent.TextureAssets.Projectile, Terraria.Main.screenPosition, Terraria.Main.spriteBatch, and System.value.

Referenced by Terraria.Main.DrawWhip().