예제 #1
0
 public override bool PreAI()
 {
     if (!begin)
     {
         Initialize();
         SpawnParts();
         begin = true;
     }
     direction = follow.X > npc.Center.X;
     rotate    = WrapAngle(ref rotate);
     ArchaeaNPC.RotateIncrement(true, ref rotate, rotateTo, turnSpeed, out npc.rotation);
     if (PreMovement() && Vector2.Distance(follow, npc.Center) > npc.width * 1.2f)
     {
         if (acc > 0.90f)
         {
             if (!npc.Hitbox.Contains(follow.ToPoint()))
             {
                 acc -= 0.01f;
             }
             else
             {
                 acc += 0.025f;
             }
         }
         npc.velocity = ArchaeaNPC.AngleToSpeed(npc.rotation, leadSpeed / acc);
         if (npc.velocity.X < 0f && npc.oldVelocity.X >= 0f || npc.velocity.X > 0f && npc.oldVelocity.X <= 0f || npc.velocity.Y < 0f && npc.oldVelocity.Y >= 0f || npc.velocity.Y > 0f && npc.oldVelocity.Y <= 0f)
         {
             SyncNPC();
         }
     }
     PostMovement();
     return(true);
 }
예제 #2
0
 public void Update(NPC npc, Player target)
 {
     proj.timeLeft = 100;
     if (npc.Distance(target.Center) < 800)
     {
         focus = target.Center;
     }
     else
     {
         focus = npc.Center;
     }
     ArchaeaNPC.RotateIncrement(proj.Center.X > focus.X, ref proj.rotation, ArchaeaNPC.AngleTo(focus, proj.Center), 0.5f, out proj.rotation);
     proj.velocity += ArchaeaNPC.AngleToSpeed(npc.rotation, 0.4f);
     VelClamp(ref proj.velocity, -10f, 10f, out proj.velocity);
 }
예제 #3
0
 public override bool BeginAttack()
 {
     foreach (Projectile proj in projs)
     {
         if (proj != null)
         {
             ArchaeaNPC.RotateIncrement(target().Center.X > npc.Center.X, ref proj.rotation, ArchaeaNPC.AngleTo(proj.Center, target().Center), 1f, out proj.rotation);
             proj.velocity += ArchaeaNPC.AngleToSpeed(proj.rotation, 0.30f);
             proj.timeLeft  = 60;
             if (proj.Colliding(proj.Hitbox, target().Hitbox))
             {
                 proj.active = false;
             }
         }
     }
     return(true);
 }
예제 #4
0
 public void Update(NPC npc, Player target)
 {
     proj.timeLeft = 100;
     if (npc.Distance(target.Center) < 800)
     {
         focus = target.Center;
     }
     else
     {
         focus = npc.Center;
     }
     ArchaeaNPC.RotateIncrement(proj.Center.X > focus.X, ref proj.rotation, ArchaeaNPC.AngleTo(focus, proj.Center), 0.5f, out proj.rotation);
     proj.velocity += ArchaeaNPC.AngleToSpeed(npc.rotation, 0.4f);
     VelClamp(ref proj.velocity, -5f, 5f, out proj.velocity);
     if (proj.velocity.X < 0f && proj.oldVelocity.X >= 0f || proj.velocity.X > 0f && proj.oldVelocity.X <= 0f || proj.velocity.Y < 0f && proj.oldVelocity.Y >= 0f || proj.velocity.Y > 0f && proj.oldVelocity.Y <= 0f)
     {
         proj.netUpdate = true;
     }
 }
예제 #5
0
 private void ProjectileDirection()
 {
     foreach (Projectile proj in projs)
     {
         if (proj != null)
         {
             ArchaeaNPC.RotateIncrement(target().Center.X > npc.Center.X, ref proj.rotation, ArchaeaNPC.AngleTo(proj.Center, target().Center), 1f, out proj.rotation);
             proj.velocity += ArchaeaNPC.AngleToSpeed(proj.rotation, 0.10f);
             proj.timeLeft  = 60;
             if (proj.Colliding(proj.Hitbox, target().Hitbox))
             {
                 proj.active = false;
             }
             if (proj.velocity.X < 0f && proj.oldVelocity.X >= 0f || proj.velocity.X > 0f && proj.oldVelocity.X <= 0f || proj.velocity.Y < 0f && proj.oldVelocity.Y >= 0f || proj.velocity.Y > 0f && proj.oldVelocity.Y <= 0f)
             {
                 proj.netUpdate = true;
             }
         }
     }
 }