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

◆ ValidateShot()

static bool Terraria.GameContent.Golf.GolfHelper.ValidateShot ( Entity golfBall,
Player player,
ref Vector2 shotVector )
inlinestatic

Definition at line 440 of file GolfHelper.cs.

441 {
442 Vector2 vector = golfBall.Center - player.Bottom;
443 if (player.direction == -1)
444 {
445 vector.X *= -1f;
446 shotVector.X *= -1f;
447 }
448 float num = shotVector.ToRotation();
449 if (num > 0f)
450 {
451 shotVector = shotVector.Length() * new Vector2((float)Math.Cos(0.0), (float)Math.Sin(0.0));
452 }
453 else if (num < -1.5207964f)
454 {
455 shotVector = shotVector.Length() * new Vector2((float)Math.Cos(-1.5207964181900024), (float)Math.Sin(-1.5207964181900024));
456 }
457 if (player.direction == -1)
458 {
459 shotVector.X *= -1f;
460 }
461 if (vector.X >= -16f && vector.X <= 32f && vector.Y <= 16f)
462 {
463 return vector.Y >= -16f;
464 }
465 return false;
466 }
static double Cos(double d)
static double Sin(double a)

References Terraria.Entity.Bottom, System.Math.Cos(), Terraria.Entity.direction, Microsoft.Xna.Framework.Vector2.Length(), System.Math.Sin(), Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.

Referenced by Terraria.Projectile.AI_150_GolfClubHelper(), Terraria.Main.DrawProjDirect(), and Terraria.GameContent.Golf.GolfHelper.FindGolfBallForHelper().