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

◆ DrawWhip_WhipScythe()

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

Definition at line 33652 of file Main.cs.

33653 {
33655 if (proj.spriteDirection == 1)
33656 {
33657 spriteEffects ^= SpriteEffects.FlipHorizontally;
33658 }
33661 int height = rectangle.Height;
33662 rectangle.Height -= 2;
33663 Vector2 vector = rectangle.Size() / 2f;
33665 for (int i = 0; i < controlPoints.Count - 1; i++)
33666 {
33667 bool flag = false;
33668 Vector2 origin = vector;
33669 float scale = 1f;
33670 if (i == 0)
33671 {
33672 origin.Y -= 4f;
33673 flag = true;
33674 }
33675 else if (i % 2 == 0)
33676 {
33677 flag = true;
33678 int num = 1;
33679 if (i > 10)
33680 {
33681 num = 2;
33682 }
33683 if (i > 20)
33684 {
33685 num = 3;
33686 }
33687 rectangle.Y = height * num;
33688 }
33689 if (i == controlPoints.Count - 2)
33690 {
33691 flag = true;
33692 rectangle.Y = height * 4;
33693 scale = 1.3f;
33694 Projectile.GetWhipSettings(proj, out var timeToFlyOut, out var _, out var _);
33695 float t = proj.ai[0] / timeToFlyOut;
33696 float amount = Utils.GetLerpValue(0.1f, 0.7f, t, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, t, clamped: true);
33697 scale = MathHelper.Lerp(0.5f, 1.5f, amount);
33698 }
33701 if (flag)
33702 {
33703 float rotation = vector4.ToRotation() - (float)Math.PI / 2f;
33704 Microsoft.Xna.Framework.Color color = Lighting.GetColor(vector3.ToTileCoordinates());
33705 spriteBatch.Draw(value, vector2 - screenPosition, rectangle, color, rotation, origin, scale, spriteEffects, 0f);
33706 }
33707 vector2 += vector4;
33708 }
33709 return vector2;
33710 }
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().