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

◆ AI_156_GetIdlePosition()

void Terraria.Projectile.AI_156_GetIdlePosition ( int stackedIndex,
int totalIndexes,
out Vector2 idleSpot,
out float idleRotation )
inlineprivate

Definition at line 42213 of file Projectile.cs.

42214 {
42215 Player player = Main.player[owner];
42216 bool num = type == 755;
42217 bool flag = type == 946;
42218 idleRotation = 0f;
42220 if (num)
42221 {
42222 float num2 = ((float)totalIndexes - 1f) / 2f;
42223 idleSpot = player.Center + -Vector2.UnitY.RotatedBy(4.3982296f / (float)totalIndexes * ((float)stackedIndex - num2)) * 40f;
42224 idleRotation = 0f;
42225 }
42226 if (flag)
42227 {
42228 int num3 = stackedIndex + 1;
42229 idleRotation = (float)num3 * ((float)Math.PI * 2f) * (1f / 60f) * (float)player.direction + (float)Math.PI / 2f;
42231 int num4 = num3 % totalIndexes;
42232 Vector2 vector = new Vector2(0f, 0.5f).RotatedBy((player.miscCounterNormalized * (2f + (float)num4) + (float)num4 * 0.5f + (float)player.direction * 1.3f) * ((float)Math.PI * 2f)) * 4f;
42233 idleSpot = idleRotation.ToRotationVector2() * 10f + player.MountedCenter + new Vector2(player.direction * (num3 * -6 - 16), player.gravDir * -15f);
42234 idleSpot += vector;
42235 idleRotation += (float)Math.PI / 2f;
42236 }
42237 }
static float WrapAngle(float angle)
Definition MathHelper.cs:87
const double PI
Definition Math.cs:16

References Terraria.Entity.direction, Terraria.Player.gravDir, Terraria.Player.miscCounterNormalized, System.Math.PI, Terraria.Main.player, System.type, Microsoft.Xna.Framework.Vector2.UnitY, Microsoft.Xna.Framework.MathHelper.WrapAngle(), and Microsoft.Xna.Framework.Vector2.Zero.