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

◆ AI_166_Dove()

void Terraria.Projectile.AI_166_Dove ( )
inlineprivate

Definition at line 39377 of file Projectile.cs.

39378 {
39379 bool num = type == 855;
39380 if (localAI[0] == 0f)
39381 {
39382 localAI[0] = 1f;
39383 frame = Main.rand.Next(4);
39384 }
39385 int num2 = 4;
39386 if (num)
39387 {
39388 num2 = 6;
39389 }
39390 if (++frameCounter > num2)
39391 {
39392 frameCounter = 0;
39393 if (++frame > 3)
39394 {
39395 frame = 0;
39396 }
39397 }
39398 spriteDirection = -1;
39399 if (velocity.X > 0f)
39400 {
39401 spriteDirection = 1;
39402 }
39403 if (num)
39404 {
39405 float num3 = 1f - (float)alpha / 255f;
39406 Vector3 rgb = new Vector3(1f, 0.6f, 0.1f) * num3;
39407 Lighting.AddLight(base.Center, rgb);
39408 rotation = velocity.X * 0.2f;
39409 if (velocity.Y < -1f)
39410 {
39411 velocity.Y *= 0.99f;
39412 }
39413 else
39414 {
39415 velocity.Y += (float)Math.Sin((float)(timeLeft % 200) / 200f * ((float)Math.PI * 2f)) * 0.25f;
39416 if (velocity.Y > 0.5f)
39417 {
39418 velocity.Y *= 0.8f;
39419 }
39420 velocity.Y = MathHelper.Clamp(velocity.Y, -1.5f, 1.5f);
39421 }
39422 float num4 = Main.WindForVisuals;
39423 if (num4 == 0f)
39424 {
39425 num4 = 0.1f;
39426 }
39427 velocity.X += 0.0525f * num4;
39428 velocity.X = MathHelper.Clamp(velocity.X, -2f, 2f);
39429 }
39430 else
39431 {
39432 rotation = velocity.X * 0.15f;
39433 velocity.Y -= 0.025f;
39434 if (velocity.Y < -3f)
39435 {
39436 velocity.Y = -3f;
39437 }
39438 velocity.X = MathHelper.Clamp(velocity.X, -5f, 5f);
39439 }
39440 if (timeLeft < 90)
39441 {
39442 alpha += 3;
39443 }
39444 if (alpha >= 255)
39445 {
39446 Kill();
39447 }
39448 }
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:46
static double Sin(double a)
Vector2 velocity
Definition Entity.cs:16

References Terraria.Lighting.AddLight(), Microsoft.Xna.Framework.MathHelper.Clamp(), Terraria.Main.rand, System.Math.Sin(), System.type, and Terraria.Main.WindForVisuals.